Account created on 1 February 2007, over 17 years ago
#

Recent comments

Maybe someone with more jquery and multivalue form understanding could tell me if this might work.

1. use js (through hook_form_alter?) to add a delete/restore button at the end of each element. use $form['#attached']?
2. if deleting, set disabled=disabled (grey it out), if restoring remove disabled
3. if deleting add a class of deleted
4. use hook_form_alter to add a new submit function that clears all the values for the elements with class=deleted

Because of my lack of deep understanding of mutlivalue elements I don't know if when a add item is clicked if any of this would even execute or if there would be some way to attach the action to the add item.

My guess is this might be able to be done in a contributed module for Drupal 7.

I guess it would be. Maybe more of an enhancement to the initial feature request.

What I was looking for was if afeigo had any jquery code/module code he's written that he could share to get this feature in place without waiting for core changes.

What if instead of hiding the deleted row it instead greyed it out and changed the delete button to restore. This would allow for deleting rows and adding rows and then all the changes would be done on save. This way if you made a mistake on the delete you could restore it.

Any chance you could share what you've done with jquery so far?

I like that this is being added to 8.x as a Feature Request but Drupal 7 is pretty early in it's life and ideally this would also appear there too.

I haven't tried this but I'm wondering if a kludge would be a button with javascript linked to it to empty the fields and then hide the row. Wouldn't degrade nicely but it's a thought.

Production build 0.69.0 2024