Thompson Marzagao wrote:

Hi all,

I am generating some form field names dynamically, based on the value of a request variable. Since I am using Niall Pemberton's LazyValidatorActionForm (see http://www.niallp.pwp.blueyonder.co.uk/), I don't have a problem getting their values. The problem is validating them.

Currently I have to specify in the validation.xml file all fields that I want validated. Since I am generating some form fields on the fly, I can't hardcode their names in the validation.xml file.

Does anybody know of a way around this? I guess I could always extend the LazyValidatorActionForm class with my own implementation of the validate method, but does anybody have a better way, so I can still have all my validation specified inside the validation.xml file?

Thanks,
Thompson

Is the forms dynamic in a way that the names of the fields is also changing, or is the field names the same?! If they are then you can specify them in struts-config.xml as form-beans with properties, but of course, then all of the validation rules would have to have the same parameters each time. In my project the change each time so I had to write the validate(...) method myself, but did it in a way where the validation logic, the classes that perform the actually validation, was external, so they could be reused.

I guess the ultimative workaround would be a code-generator that wrote the struts-config and the validation config on the fly ;-)

Claus

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to