Hi Ralf, > > You should also take a look at the isValid() method of the form. > > Are you talking about the ZF or the Dojo part of the form? I thought > that the isValid() method form is called automatically if I use > Zend_Dojo_Form and combine it with ValidationTextBox dijits.
I was talking about the dijit.form.Form::isValid() method. > Do I need to call the Dojo client-side validation manually when the > form is submitted? No, you don't. You are right, that it will be called on submit (and the dijit.form.Form::isValid() metod will call the isValid() method of all embedded validateable controls). The problem is, that this won't set the status indicator, as you already noticed. You need to extend the widgets or wrote your own, which will behave like you want. We for example wrote our own form control widgets: It has two parts: 1) Form submit button control We wrote a small widget, which will connect to each form control widget's isValid() method. If our validateable input element reports "false", the form submit button control will disable the "submit" button. So the initial state of our forms is a form with a disabled submit button. 2) Own custom input controls We wrote our own validateable controls. Like Dojo's original form widgets, validation is triggered by the onFocus event (that's done, because we don't want to display any errors when the form is loaded for the first time). But we are able to set a flag, which will trigger validation immediately. This is useful, if you load an existing "object" and want to show there's an error, which must be corrected (e.g. after failed server-side-validation). So yes: A dijit.form.Form form will only be submitted, when all input controls reports "true" on the isValid() call from the dijit.form.Form widget. A browser with JavaScript support, will never submit such a form, when it's invalid. The status indicator of an invalid control will only be set by the onFocus event. That's all wanted by design. -- Regards, Thomas
