PDA

View Full Version : Checking form for invalid



KajaSheen
15 Mar 2012, 11:29 AM
I have a form that get's submitted, now there might be errors returned by the server that are not caught by the client validation. For example that a username is already taken.

Now I mark those fields as invalid, but that has no influence to the client side validation, as stated in the documentation:


Note: this method does not cause the Field's validate or isValid methods to return false if the value does pass validation. So simply marking a Field as invalid will not prevent submission of forms submitted with the Ext.form.action.Submit.clientValidation option set.

But is there a way to check whether the form has any of those markedInvalid fields? BasicForm.isDirty() does not help, since it seems that submitting the form triggers the trackResetOnLoad chain and even if the operation returns as unsuccessful, the last submitted values are not marked as dirty.

mitchellsimoens
15 Mar 2012, 11:46 AM
It may have an activeError property that is set when markInvalid happens.