Skip to content Skip to sidebar Skip to footer

Add And Remove Values In A Hidden Field Array

I don't understand pretty well how the hidden fields arrays work, I have this input: How can I add and remove values to and f

Solution 1:

As I said in my comment, this link will probably help you a lot: JSFiddle

After the submit, in your controller, the split() method will help you to convert your String to an array of String.

For example:

def myList = params.myInput.split(',')

And I think (not sure) that you need to add a name for you input, in order to use the params scope (like <input type="hidden" name="myInput" />).

Solution 2:

If you array is ftpIds[] just write

delete ftpIds[3];

Keep in mind that delete does not alter the array.length() property.

You can also use array.pop() to remove the last element in the array and reduce size by one. It will also return the removed element.

But i don't see an array... I see an ID

Post a Comment for "Add And Remove Values In A Hidden Field Array"