Hello,
I am trying a common scenario, where I want to dynamically create form
fields and either add or remove some fields. The fields are a List of
objects. I using the following approach described in short:
AddObjectAction:
List<MyObject> myObjectList;
prepare(){if == null (3x) add ... else add 1x}
String delete(){ myObjectList.remove(int listPostion) }
home_jsp:
<s:form id="form">
<s:textfield key="anotherField" />
<s:div id="objectsDiv" theme="ajax" href="%{getListOfObjects}"
formId="form"> </s:div>
</s:form>
addObjectAction-success.jsp:
<s:iterator value="myObjectList" status="status">
<s:url id="deleteObject[#stat.index]">
<param name="listPosition" value="#stat.index" />
</s:url>
<s:textfield key="myObjectlist[#stat.index].value1" /> ......
<s:submit formId="form" value="-"
href="%{deleteObject[#stat.index]" />
</s:iterator>
This works, but does not refresh the div objectsDiv. Using target does
not work because objectList does not get onto the request, without
target the objectList is on the request. I tried to set the objectList
as a param to s:url deleteObject, this kind of works but results in a
param intercepter exception (haven't tried a custom converter yet).
When having the div put the fields from formId="form" onto the request
it only puts the fields onto the request that itself does not hold. In
example only the 'anotherField'.
I think this should work this way. Why does setting target result in
removing the myObjectList on the request? Why does s:div formId not put
the fields on request itself holds?
Many thanks in advance
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]