So I have a question which I haven’t found an answer to. I know that when collecting tabular input you need to add [$i] to your fields (in my case ‘[$i]distance’) and that $i needs to be an index from 0 to x depending on the number of elements on the form.
I’m jusing JQuery to clone a div which contains my “many” inputs whoever I’m not sure how to dynamically update $i for each row of inputs.
Really Simple jquery:
function addSet()
{
$("#set:last").clone().appendTo("#set_wrapper");
}
I managed to solution to this problem that incorporates PHP and JQuery. It ended up being a smarter solution which helps protect the site from users "spamming" a feature.
First I used a simple for loop to iterate through the "sets" input.
At the bottom of my page I have two buttons “Add Set” and “Remove Set” which simply show or hide additional input rows. I need to go back in and make sure I remove any user input when I remove a row because my actionCreate method checks null rows before it saves and simply “hiding” a row doesn’t clear the data if a user has already entered something.
Anyway thought I’d share in case someone else was running into this problem.