Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented May 8, 2013

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
Copy link

efexen commented May 22, 2013

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

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

var field = $link.closest('.fields');
field.hide();

field.find('*').removeAttr('required');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to use $('[required]', event.field).removeAttr('required');.

@lest
Copy link
Collaborator

lest commented Oct 15, 2013

Could you please update Prototype version too?

@markmcdonald51
Copy link

markmcdonald51 commented Oct 18, 2016

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');
  });
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants