I'm doing in line table editing and it works.

Here's a (very) cut down version of my form.  The code displays a
form/table, where each line in the table corresponds to an element/item in
the prLines collection of the action.

<s:form name="savePurchaseRequest" action="savePurchaseRequest"
method="post" validate="false" theme="xhtml">

<s:iterator value="prLines" status="status">
        <tr>
        
                <s:set name="zi" value="#status.index" scope="request"/>
                
                <s:label value="%{partNm}"/>                    
                <s:label value="%{supplierNm}"/>                        

                <s:textfield name="prLines[${zi}].quantity"  
value="%{quantity}" size="8">
                        <s:param name="after">
                                <s:hidden name="prLines[${zi}].partId"  
value="%{partId}"/>
                        </s:param>
                </s:textfield>

                <s:textfield name="prLines[${zi}].internalComments" 
value="%{internalComments}" />
        </tr>
</s:iterator>

</s:form>

(I'm using a heaviliy modified xhtml theme that required me to use explicit
<tr> tags in case anybody is wondering)

This generates, for example, for one of the fields in the the table
   <s:textfield name="prLines[0].quantity"  value="23" size="8">

And this works a treat, populating the collection in the action. Great!

But I was hoping that generating the simpler html
   <s:textfield name="prLines[].quantity"  value="23" size="8">
would work but it doesn't seem to create anything in action. 

Generating the indexes is not that hard, but I'm in a situation now where I
am moving rows from one table to another via dhtml and of course managing
the indexes is fiddly.

Is there a better/simpler way of managing multiple fields (possibly without
being forced to maintain the indices)? 

Also, is there a way of using the struts2 field validation framework with
multiple fields? 


-- 
View this message in context: 
http://www.nabble.com/s2--Is-this-a-sensible-way-of-doing-in-line-editing-in-a-table--tf3296620.html#a9170727
Sent from the Struts - User mailing list archive at Nabble.com.


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

Reply via email to