Thank you guys! You've been very helpful. I now make the validation in submit but it's not pretty; in the submit listener I have this:
if(!validateFieldX()) { setFieldXValid(false); return null; } and in the html I have an @If to display validation message if validation has failed. Is there a neater way or is this "how it is done"? Malin On 12/3/06, Sam Gendler <[EMAIL PROTECTED]> wrote:
Why not just build the set of validators for the field dynamically? Assuming you can determine whether the field should be required by the time the field rewinds (rather than being dependant on something not yet rewound), then you can include the required validator in the list only if it is actually required. However, since the 'required' validator is obviously called whether the field has a value or not, I would suggest taking a look at the source for that validator to determine where you have gone wrong with yours. It is clearly possible. Without seeing your source, that's about the best I can suggest. --sam On 12/2/06, Malin Ljungh <[EMAIL PROTECTED]> wrote: > Good evening! > > I have written my own validator which works excellent - as long as a value > is submitted in the field to be validated. Have I missed something here? > What should I do? > > To add a required validator may seem to be the obvious solution but the > thing is that the field is not always required - it depends. > > Cheers > Malin > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]