Thanks, Yansheng. I am not sure I understand. I tried <field property="allUsers" indexedListProperty="allUsers" depends="required,email"> <arg0 key="userListForm.allUsers.email"/> </field>
Is that what you meant? It does the same thing (empty JavaScript.) I don't understand how your solution is *supposed* to work. I want to validate the email field of every Info object in the allUsers collection. Did I misunderstand your suggestion? Thanks! --johnt in article [EMAIL PROTECTED], Yansheng Lin at [EMAIL PROTECTED] wrote on 8/14/03 8:31 AM: > > I can see one spot that could lead to problem. > > In your iterate, the var name is "allUsers". However, in your > validation.xml, > the field property is "email". The name of the iteration var has to be the > same as the property name of the array in the form. > > Hope this works. > > - Yansheng > > -----Original Message----- > From: John Tangney [mailto:[EMAIL PROTECTED] > Sent: August 13, 2003 5:22 PM > To: [EMAIL PROTECTED] > Subject: Trouble with validation of nested properties -indexedListProperty? > > > Hi all, > > I have memorized the docs, scoured the archives, googled 'till my eyes were > crossed, experimented at great length, but have not been able to solve this > riddle. > > I have a JSP that looks like this: > > <nested:iterate property="allUsers"> > <tr> > <td><nested:text property="userName"/></td> > <td><nested:text property="email"/></td> > </tr> > </nested:iterate> > > > My form bean has > > public List getAllUsers() { > return this.allUsers; > } > > Which returns a collection of... > > public static class Info { // an inner class of the form bean, FWIW > private String email; > private String userName; > > public void setEmail(String string) { > email = string; > } > > public String getEmail() { > return email; > } > ... > } > > Everything's great - works perfectly; does what I want. It's a pattern I use > all over the place, on several projects. > > Next, I want to add validation: > > In the JSP I add <html:javascript formName="userListForm"/> in the head. My > form bean now extends ValidatorForm. > > In my validation.xml I add: > > <form name="userListForm"> > <field property="email" indexedListProperty="allUsers" > depends="required,email"> > <arg0 key="userListForm.allUsers.email"/> > </field> > </form> > > > *** The validation doesn't work.*** > > I am more concerned about client-side validation, so let's look at that: > > The generated JavaScript looks like this: > <!-- Begin > > var bCancel = false; > > function validateUserListForm(form) { > if (bCancel) > return true; > else > return validateRequired(form) && validateEmail(form); > } > > function required () { > } > > function email () { > } > > This tells me that my struts-config-*.xml is correct, but that validator is > unable to generate the correct code based on what I said in my > validation.xml. > > Can some kind soul please help me correct my validation.xml? I have tried > using indexedProperty, which causes the two JavaScript functions to be > generated, but with incorrect values. I have tried rewriting the whole thing > using <logic:iterate> but that gets me into a mess of other changes. > > Please, please, can someone help? > > Thanks > --johnt > > > > > > --------------------------------------------------------------------- > 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]