On 07/07/05, Hubert Rabago <[EMAIL PROTECTED]> wrote: > What do you mean when you say it doesn't work?
I mean that when I input characters in an integer-only field, the validation is not triggered, the values are just set on the form. However, I have tried to dig a bit more into this, and have looked at the html generated. And it looks like it might have something todo with the fact that we are running struts inside a portal. The plain form attributes are prefixed with a string by the portal, but the attributes defined using nested, are not. The odd thing though, is that the values do get to the form, they just don't seem to be validated. Does the Validator reference the form attributes in a different way then the form population? Any ideas? Kjersti > I compared your code with something I have that's working and they > look pretty much the same. I have a form with a list of employees, > and each employee has fields such as "birth". > > The HTML form looks something like this: > <nested:iterate property="employees"> > <nested:text property="birth" size="10" maxlength="10"/> > <nested:text property="ssNumber" size="9" maxlength="9"/> > <nested:text property="salary" size="12"/> > </TR> > </nested:iterate> > > Validation rules look like this: > > <field property="birth" indexedListProperty="employees" > depends="required,date"> > <arg0 key="employeeform.birth.displayname"/> > <var> > <var-name>datePatternStrict</var-name> > <var-value>MM/dd/yyyy</var-value> > </var> > </field> > <field property="ssNumber" indexedListProperty="employees" > depends="required,integer"> > <arg0 key="employeeform.ssnumber.displayname"/> > </field> > <field property="salary" indexedListProperty="employees" > depends="required,mask"> > <arg0 key="employeeform.salary.displayname"/> > <var> > <var-name>mask</var-name> > <var-value>^\$?\d+(,\d{3})*(\.\d{2})?$</var-value> > </var> > </field> > > This app is using Struts 1.2, though. If you want to try it out, it's > available at http://www.rabago.net/struts/formdef/dev/nested.war . > It's using FormDef (which is a Struts plugin) but FormDef doesn't > affect validation, so the same rules apply. Using nested tags also > don't affect validation. In fact, you could use plain old HTML tags > and still use Validator, as long as you name your fields correctly > and/or populate your form beans properly. > > Hubert > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]