Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form control with name is not focusable error on browser. #2492

Closed
SuperMasterBlasterLaser opened this issue Dec 1, 2015 · 6 comments
Closed

Comments

@SuperMasterBlasterLaser
Copy link
Contributor

After solving issues of nested models, I have encountered new problem.

For example you have Parent and Child model. Parent has many Children. Child has validation of precense of Parent.

In rails_admin when you try to create Child and not assign Parent then click to Save. It gives Javascript error:

    An invalid form control with name='child[parent_id]' is not focusable.

1

And I have found why this is happening. This drop-down form element is not drop-down at all. It is input text field with autocomplete Jquery functionality.

The real select field that assigns Parent to Child is here:

2

HTML inspector shows that select field that assigns parent has display:none style among with required type!.

When user clicks to Save and this field is empty, browser validation will be promted. Browser tries to focus to it, because it has display:none value it throws javascript error that is mentioned above.

@SuperMasterBlasterLaser
Copy link
Contributor Author

This could be resolved by using this code:

RailsAdmin.config do |config|
  config.browser_validations = false
end

This makes browser side validations useless.

@JIucToyxuu
Copy link

It's not solution, but dirty hack. Because will disabled all HTML validation.

@AlexWheeler
Copy link

AlexWheeler commented Apr 7, 2017

setting style to opacity:0;pointer-events: none; cursor: default; over display: none could fix this problem. It is hidden (although still in the dom) and focusable. Might be worth looking into.

@ivercinsky
Copy link

ivercinsky commented Jun 26, 2017

i have the same issue but with ck_editor.

I fixed the select using the suggestion of AlexWheeler but i cant hook the js function to change the css properties of the ck_editor.

Does anyone have had this issue ?

Thanks

@Zmokizmoghi
Copy link

Same here
gem version: rails_admin (1.2.0)

@fatosmorina
Copy link

I had the same issue. I figured out that I had set required true for a relation that I was not filling in when I was adding a new element. Removing required true solved my issue.

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

No branches or pull requests

6 participants