Hello again,
Let me try to define a simular problem that I have that would most probably answer Stéphane's.
But only Stéphane can confirm this. :)
Well, I do ! :-) This is the same kind of problem I have encountered.
I don't use a list, just an array (although a List would do just fine, of course).
For instance, I have something like
public class Person { string name,fname,email; // then setters/getters ... }
... and a form a little bit like this :
<html:form ... styleId='f'>
<script language="javascript" type="..."> function addMoreFields() { var f = document.getElementById('f'); var nb = document.getElementById('nb').value; f.innerHTML = null; f.innerHTML = "<input type='text'" + " value='" + nb + "' id='nb' " + onchange='addMoreFields() />'" for (var i = 0; i < nb; i++) { // here I'd need to make indexed properties // work, sth like : f.innerHMTL += "<input type='text' " + "name='persons["+i+"]name' />"; // ... and the same for fname and email ... } } </script>
<html:text styleId='nb' property="nb" value="0" onchange="addMoreFields()"/><br /> <!-- Here I must insert new sets of fields ... -->
<html:submit/> </html:form>
I use DynaActionForms : (excerpt from struts-config.xml) <form-bean name="indexpropsForm" type="org.apache.struts.action.DynaActionForm"> <form-property name="nb" type="java.lang.String"/> <form-property name="persons" type="fr.altasys.struts.Person[]" /> </form-bean>
So basically, When I retrieve the Person[] object in my Action class, the length of the array is 0... Which is quite annoying, since I've filled "nb" sets of fields ... ! :-)
I hope I am a bit clearer now :-)
Thanks for the help !
-- Stéphane Zuckerman
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]