SmartClient Version: SC_SNAPSHOT-2012-01-19_v8.2p/PowerEdition Deployment (built 2012-01-19)
Hi,
I have a dynamicForm where I do server side validation using the DMI in the dataSource. In my Java class I always return false, but when I click the button and I do an alert I see that the whole validation form is always true, even if there is a field with a validation error. Am I missing something? Well as far as I understand if one field is not passing validation than the form.validate() should return false for the whole form and specified field is pointed out with exclamation mark, or am I missunderstanding something.
Here is my code:
DynamicForm:
DataSource:
Hi,
I have a dynamicForm where I do server side validation using the DMI in the dataSource. In my Java class I always return false, but when I click the button and I do an alert I see that the whole validation form is always true, even if there is a field with a validation error. Am I missing something? Well as far as I understand if one field is not passing validation than the form.validate() should return false for the whole form and specified field is pointed out with exclamation mark, or am I missunderstanding something.
Here is my code:
DynamicForm:
Code:
isc.DynamicForm.create({
ID: "frm_main_search",
dataSource:"search_validationDMI",
autoDraw:false,
numCols: 4,
synchronousValidation:true,
fields: [
{name:"criteria", title: "Search By", editorType:"comboBox", wrapTitle:false, defaultToFirstOption: true},
{name:"criteria_value", title:"Look for", type:"text", width:"200", validateOnExit:true, wrapTitle:false, keyPress: "if (keyName == 'Enter') {btn_main_search.click(); }"}
]
}),
isc.IButton.create({
ID:"btn_main_search",
title:"",
icon : "icons/magnifier.png",
autoFit: true,
autoDraw: false,
align: "center",
click: function() {
alert(frm_main_search.validate());
}
})
Code:
<DataSource
ID="search_validationDMI"
>
<fields>
<field name="criteria" required="true">
<valueMap>
<value ID="login">Login</value>
<value ID="IP">IPv4 Fix</value>
<value ID="surname">Nom</value>
<value ID="phone">Phone</value>
</valueMap>
</field>
<field name="criteria_value" type="text" required="true">
<validators>
<validator type="serverCustom">
<serverObject lookupStyle="new" className="lu.azevedo.smartclient.ValidationDMI"/>
<errorMessage>$message</errorMessage>
</validator>
</validators>
</field>
</fields>
</DataSource>
Comment