Hi,
facing a similar issue I addressed it by having a form per record 
instead of a form for the whole table.
Then everything becomes easier :) hereafter a code sample to illustrate.

<logic:iterate id="taskForm" indexId="taskFormIndex" 
name='<%=TaskAction.TASK_FORM_LIST%>'  scope="session">
  <html:form action="/taskView2">
    <tr>
      <td>
        <html:hidden name="taskForm" property="index">
          <bean:write name="taskFormIndex" />
        </html:hidden>

        <html:hidden name="taskForm" property="id">
          <bean:write name="taskForm" property="id"/>
        </html:hidden>

        <html:submit property="edit">
          <bean:message key="button.edit"/>
        </html:submit>

        <html:submit property="delete">
          <bean:message key="button.delete"/>
        </html:submit>

        <html:submit property="assign">
          <bean:message key="button.assign"/>
        </html:submit>
      </td>
      <td>
        <bean:write name="taskForm" property="name"/>
      </td>
      <td>
        <bean:write name="taskForm" property="projectId"/>
      </td>
    </tr>
  </html:form>
</logic:iterate>    

Each taskForm property represents :
1. Data corresponding to a database task record
taskForm.id property holds the primary key value of a task record.
2. Data useful for view control
taskForm.index property holds the index of the taskForm object in the 
iterated Collection an ArrayList in this particular case.
Useful for editing the selected object without querying the database.

I hope it might help, Patrick



Maturo, Larry wrote:

>Hi David,
>
>I have tried endless variations of the hidden variable
>in each row trick you suggested.  It seems like it should
>be very simple, but each time I run into the problem of 
>the variable I pass in to "value" does not get evaluated,
>instead it comes through in the html as the literal I
>pass in to it.  Below is an example of what I have 
>tried doing.  As you can see, I have put two variations
>of the variable I am trying to use in the table to make
>sure that part is working, and it is.  Can I ask you how 
>you got this to work?
>
>Thank you in advance for any help.
>
>-- Larry Maturo
>   [EMAIL PROTECTED]
>                            
><logic:iterate id="org" name="<%= Constants.ORG_LIST %>" scope="session"
>type="com.athensgroup.projtrack.controller.org.OrganizationForm">
>       <bean:define name="org" property="id" id="orgId" />
>      <tr>
>       <td>
>               <html:submit property="id" value="Edit" />
>            </td>            
>            <td><bean:write name="org" property="mnemonic"
>filter="true"/></td>
>            <td><bean:write name="org" property="fullName"
>filter="true"/></td>
>            <td><bean:write name="org" property="type" filter="true"/></td>
>            <td><bean:write name="org" property="id" filter="true"/></td>
>            <td><bean:write property="orgId" filter="true"/></td>
>            <td>
>                <bean:write name="org" property="parentOrgName"
>filter="true"/>
>                   <html:hidden property="theOrgId" value="orgId" /> 
>               </td>
>      </tr>
></logic:iterate>
>
>-----Original Message-----
>From: David M. Karr [mailto:[EMAIL PROTECTED]]
>Sent: Saturday, January 26, 2002 1:00 PM
>To: [EMAIL PROTECTED]
>Subject: Re: Help with table with edit buttons
>
>
>>>>>>"Larry" == Larry Maturo <Maturo> writes:
>>>>>>
>
>    Larry> I have a table that displays information on a number of
>    Larry> items.  Each table entry has an edit button, so that you
>    Larry> can edit the information on that item. I use an iterate 
>    Larry> tag to populate the table.  My problem is that I don't
>    Larry> know how to save something indicating which edit button
>    Larry> they pressed.
>
>    Larry> My best guess was to use an onclick handler to set a
>    Larry> hidden variable.  My problem is that while I know how
>    Larry> to create the hidden variable (using the struts hidden
>    Larry> tag) I don't know how to set it in the onclick handler.
>
>One approach is not to try to determine which edit button was pressed, but
>to
>use a hidden field in a form in each table row to encode the OID of the
>object
>in that row.  Each form row submits to the same action.
>



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

Reply via email to