Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

form.getValues() returns formatted value when using formatValue and formatOnBlur

$
0
0
SmartClient Version: v10.0p_2014-11-16/EVAL Development Only (expires 2015.01.15_12.11.41) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

Chrome on OSX

please modify the #formatRelatedValue sample like this:

Code:

isc.DynamicForm.create({
    ID:"testForm",
    items : [
        { name:"otherEmployeeName", title:"Employee", type: "comboBox",
          optionDataSource:"employees",
          valueField:"EmployeeId", displayField:"Name",
          pickListFields:[
              {name:"Name"},
              {name:"Email"}
          ],
          width:250, pickListWidth:350,
          formatOnBlur: true,
          formatValue : function (value, record, form, item) {
              var selectedRecord = item.getSelectedRecord();
              if (selectedRecord != null) {
                return selectedRecord.Name + " (" + selectedRecord.Email + ")";
              } else {
                return value;
              }
          }
        }
    ]
});

Please select an option, then press tab to have it formatted.
Now, if you evaluate testForm.getValues() you'll obtain something like
{otherEmployeeName: "Tamara Kane (tkane@server.com)"}

instead of the correct {otherEmployeeName: 182} which you obtain when not formatted.

Viewing all articles
Browse latest Browse all 4756

Trending Articles