Results 1 to 4 of 4

Thread: Multirecord Form

  1. #1
    Join Date
    Apr 2007
    Posts
    2

    Thumbs down Multirecord Form

    Hello,

    Is there a way to handle an array of command objects in a form?

    What I need is to show a list of command objects in a <table>, allow the operator to edit the <td> cells and maybe add or delete rows in the <table> (using JavaScript for example) and in the submit receive the list of command objects in the POST handler method.

    Each <tr> in the table would be a command object and the grid is the full list.

    Plea help, Thanks

  2. #2

    Default

    You might find it easer to create a new class that more closely mimics the specific form you need to display. Then binding the form data to the form backing class becomes trivial, and you can write some simple logic on the server side to translate the form backing object into a collection of whatever your present domain objects.

  3. #3
    Join Date
    Jul 2008
    Posts
    157

    Default

    Code:
    <form:form modelAttribute="formModel" cssClass="compactForm">
       <table>
       <c:forEach items="${formModel.rows}" varStatus="loop">
          <tr>
             <td><form:checkbox path="rows[${loop.index}].selected" /></td>
             <td><form:input path="rows[${loop.index}].name" /></td>
          </tr>
       </c:forEach>
       </table>
    </form:form>

  4. #4
    Join Date
    Apr 2007
    Posts
    2

    Default Thankyou

    Thanks,

    The form works great.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •