ryanb / nested_form

Rails plugin to conveniently handle multiple models in a single form.
MIT License
1.79k stars 505 forks source link

Removing the first "remove link" #292

Closed tquill closed 10 years ago

tquill commented 10 years ago

The gem seems to be working great, but I have a question I didn't seen when looking at the comments.

I'd like the user be able to add new fields, and remove them if necessary... but the first field is required. If I build the first field, it has the remove link like the others... so I want to get rid of that remove link from the first field so it can't be removed.

Is there an elegant way to do this? I know I could put it in a div, then remove it if it's the first... but I was hoping there was better way that someone knows about.

lest commented 10 years ago

You can use JavaScript Events and hide/remove remove link if there's only one field left.