ryanb / nested_form

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

Fix for Issue #262: 'is not focusable' error #263

Open ghost opened 11 years ago

ghost commented 11 years ago

link_to_delete now hides the form element and also removes the 'required' attribute on any children of the field being deleted.

field.find('*').removeAttr('required');

efexen commented 11 years ago

Whilst waiting this JS work-around gets you going again:

$(document).on('nested:fieldRemoved', function(event){
  event.field.find('*').removeAttr('required');
});
lest commented 10 years ago

Could you please update Prototype version too?

markmcdonald51 commented 7 years ago

Just add this to your assets/javascripts/application.js at it will fix this:

jQuery(function ($) {
  $(document).on('nested:fieldRemoved', function (event) {
    $('[required]', event.field).removeAttr('required');
  });
});