I'd like to post an array of n length to a form. What's the best way to handle this?
The object is a Timesheet, which has a date, and an array of Lines.
Lines have a duration, category, and note field.
My form has a date field, and one line to start, and jQuery appends more lines as necessary.
I know I need to use bracket notation somehow, but I don't know how considering I have two objects nested.
FWIW, the application end of things is in Node.js and express.
<form id="timesheet" method="POST" action="/timesheets">
  <label>date for timesheet</label>
  <input type="date" name="date"/><br/>
  <ol id="timesheet-list">
    <li>
      <input type="number" name="hours" min="0" value="0" step=".25"/>
      <input type="text" name="category"/>
      <input type="text" name="details"/>
    </li>
  </ol>
  <input type="submit"/>
</form>
<a id="addItem" href="#">Add a new line item</a>
<script type="text/javascript">
  $('#addItem').click(function(e){
    e.preventDefault();
    $('#timesheet-list').append('<li><input type="number"> <input type="text"> <input type="text"></li>');
  });
</script>
 
     
     
     
    