I’m creating a dynamic form builder where table rows can be dragged, dropped, reordered and so on. Most of this is working but when it comes to deleting rows how would I created an array or set of values that I could post back to the php script that I am using to update the database.
The way I am going to handle it is create a delimited string and post this back.
How would I go about creating the the string dynamically by appending a value like the following: 23| every time the user clicks a button? For example the if user click the button 3 times the sting would be 23|25|26| and then when they clicked save that value could be posted back to be processed.
This is the code I have for the delete function so far but its only removing the table rows and not actually generating the string.
$(".reMove").live('click', function(e) {
$(this).parent().parent().remove();
var al = $(this).attr('rel');
$("#form1").find(".del").val(al);
e.preventDefault();
sortt();
});
I would use an array:
Alternately, if you like, you can just use a string and append to it:
…but I prefer the array route.