" then your model will have invalid data, and if that is acceptable, what role does the validator fill then? You might as well do your checks in onSubmit() at that point..."
I guess it depends, I normally haven't had a need to validate every individual component. But I like having all of my model objects with their values and then doing validation of those values/types before the form is submitted. getConvertedInput would work "what role does the backing object fill" if you can't using them during your validation. I guess in some cases you want an override switch to allow the model object to get updated with the input pre-validation. ... As a hack, we normally just add ajaxbehaviors on the components and their values get updated, then I can do form validation with all the updated models. -----Original Message----- From: Wilhelmsen Tor Iver [mailto:[email protected]] Sent: Friday, July 29, 2011 5:04 AM To: [email protected] Subject: RE: getInput and getDefaultModelObject and validation > Is there a way to force a modelobject update on each individual field > and then do my form validation. It seems you want to use getConvertedInput(). Going via the model to get the converted value is just a detour when you are in a validator. If you push data to the model and then decide it is invalid, then your model will have invalid data, and if that is acceptable, what role does the validator fill then? You might as well do your checks in onSubmit() at that point... > if (textField1.getInput() == "creditCard") { You should be aware that this code will most likely fail. Look into equals(). - Tor Iver --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
