0

I have a custom made data form, with therein a datagrid with multiple fields. I have made the possibility to add entries, in the background adding rows by adding input elements with the correct names:

<input name='field_id_16[rows][new_row_0][col_id_1]' type='text'>
<input name='field_id_16[rows][new_row_0][col_id_2]' type='text'>

.. etc.

this checkout the correct field and column names, and everything is going as planned. now I also built in the possibility of deleting, and as long I take care of the 'new_row_x' numbering, this all goes well.

now my problem is when the user deletes all entries. I don't have the form elements anymore (because there should be none - when the user removes all datarows) giving a value, and i don't know how to custom update a datagrid which used to elements, back to being empty...?

anybody knows what to do?

greets Rick

2
  • What happens when you submit with the rows removed? Does it erase them, or just keep them? Jul 30, 2014 at 17:06
  • It just keeps them, but after a bit more trying different possibilities I found out how to update to a empty grid
    – Rick
    Aug 4, 2014 at 7:17

1 Answer 1

0

After a bit more trying different things, I found out that by just using the field id name and keeping the value empty, submitting the form empties the grid.

see in my case (the grid having database id 16):

<input type='hidden' name='field_id_16' value=''>

empties the grid when submitted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.