After upgrade from smartgwt 3 to smartgwt 5 (current version is 5.0p.2016-06-25) we noticed strange behavior for validation from valueManager.validate(). (Browser: FF 26 version)
I tried to reproduce the problem on the DMI Validation show case for better explanation our conditions (version 5.0p.2016-06-25).
Here is the changes which I inserted into DMIValidationSample class and also one small change into validationDMI_orderForm.ds.xml file.
DMIValidationSample.java validationDMI_orderForm.ds.xml
We have several dynamic forms with the different fields from the same datasource and common valueManager.
One of the fields from one form has serverCustom validator (in our case it is quantity), and another field from the second form is required(in our case it is instructions).
When we fill ALL fields we click on submit button and call valueManager.validate() .
In the dev console we see validation request which is failed.
But we don't see any errors on the forms, which are actually correct because forms are valid (we filled all fields correctly).Also if clear value from quantity field we will not see any error messages.
After investigation I realized that valueManager.validate() calls inside dynamicForm.validate -> Canvas.fireServerValidation -> dataSource.validate method but only with the values from the fields belonging to this current dynamic form.That's why we don't see field instructions in the request, because it is from another form.
We also checked smart gwt3 version for this behavior and response for validation request was successfull. (May be because there was no datasource validation inside?? )
If to come back to our personal case in our application where we call valueManager,validate() before valueManager.save() :
if (valuesManager.validate()) {
DSRequest requestProperties = new DSRequest();
requestProperties.setWillHandleError(true);
valuesManager.saveData(callback, requestProperties);
}
then we can notice also that valueManager.validate() always returns true (even we serverCustom validator described in datasource return false). And it looks like that serverCustom Validator was not called at all.(Breakpoint was not touched during debugging in DMI Validator class. ).
But this serverCustom Validator was called in the call to valuesManager.saveData(). So again some validation happened and only then we can see error message on the forms.
Could you please explain such behavior?Why it was changed? Is it considered as a bug?(we didn't change our logic at this piece of code since smart gwt 3 version)
Thanks in advance, Ksenia
I tried to reproduce the problem on the DMI Validation show case for better explanation our conditions (version 5.0p.2016-06-25).
Here is the changes which I inserted into DMIValidationSample class and also one small change into validationDMI_orderForm.ds.xml file.
DMIValidationSample.java validationDMI_orderForm.ds.xml
We have several dynamic forms with the different fields from the same datasource and common valueManager.
One of the fields from one form has serverCustom validator (in our case it is quantity), and another field from the second form is required(in our case it is instructions).
When we fill ALL fields we click on submit button and call valueManager.validate() .
In the dev console we see validation request which is failed.
But we don't see any errors on the forms, which are actually correct because forms are valid (we filled all fields correctly).Also if clear value from quantity field we will not see any error messages.
After investigation I realized that valueManager.validate() calls inside dynamicForm.validate -> Canvas.fireServerValidation -> dataSource.validate method but only with the values from the fields belonging to this current dynamic form.That's why we don't see field instructions in the request, because it is from another form.
We also checked smart gwt3 version for this behavior and response for validation request was successfull. (May be because there was no datasource validation inside?? )
If to come back to our personal case in our application where we call valueManager,validate() before valueManager.save() :
if (valuesManager.validate()) {
DSRequest requestProperties = new DSRequest();
requestProperties.setWillHandleError(true);
valuesManager.saveData(callback, requestProperties);
}
then we can notice also that valueManager.validate() always returns true (even we serverCustom validator described in datasource return false). And it looks like that serverCustom Validator was not called at all.(Breakpoint was not touched during debugging in DMI Validator class. ).
But this serverCustom Validator was called in the call to valuesManager.saveData(). So again some validation happened and only then we can see error message on the forms.
Could you please explain such behavior?Why it was changed? Is it considered as a bug?(we didn't change our logic at this piece of code since smart gwt 3 version)
Thanks in advance, Ksenia
Comment