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

Broken Client Side Validation for filtering select #2398

Closed
cec opened this issue Sep 10, 2015 · 8 comments
Closed

Broken Client Side Validation for filtering select #2398

cec opened this issue Sep 10, 2015 · 8 comments

Comments

@cec
Copy link

cec commented Sep 10, 2015

Hi,

when a required attribute is left empty, upon form submission, a tool-tip is shown on the field.

When the required attribute is a relation, the client-side navigation does not work.

In Chrome there is no visible reaction, but in the console the following error pops up:
An invalid form control with name='property[feature_id]' is not focusable.

In Firefox, the tooltip shows up in a completely wrong location (see picture below).

I'm pretty sure the the cause is that for filtering-select, the invisible select tag has the attribute
required="required"
and this freaks out Chrome and breaks the positioning of the tooltip on Firefox.

I believe that for associations, the required attribute needs to be moved to the visible controls.

screen_shot_2015-09-10_at_15_28_02

I'd gladly contribute a pull-requrest myself, but I don't understand very much the form-rendering logic in rails-admin.

@fmh
Copy link
Contributor

fmh commented Sep 10, 2015

look her #2339

@SuperMasterBlasterLaser
Copy link
Contributor

Maybe related to my issue #2492

@vemv
Copy link

vemv commented Dec 4, 2015

@SuperMasterBlasterLaser it is, so your issue is a duplicated one.

I suggest to close - a high issue count isn't precisely motivating!

@JIucToyxuu
Copy link

JIucToyxuu commented Nov 8, 2016

I'm have same problem.

I'm have required field on model and use Enumeration for generate select-box with values. Generated be hidden and have attribute 'required'. It's see like logic error. I think disable HTML validation it's not best solution, because then we will have more requests to server(HTML validation prevent many requests with invalid data). Plus, config.browser_validations = false will disable HTML validation for all input elements of rails_admin application. P.S. I think 'required' attribute should be add to visible input element.

@ain
Copy link

ain commented Dec 2, 2016

Reproduced for 1.1.0. Also prevents visible controls to be highlighted, the JavaScript console throws

An invalid form control with name='product[product_category_ids][]' is not focusable.

Flash notifications do not appear either. Probably because of the JS breakdown.

UPDATE: I was able to resolve with

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

Nevertheless, I think it's a bug. JS should be safeguarded and not throw up.

@ivercinsky
Copy link

Hi, anyone found a way to fix this issue?

@JIucToyxuu
Copy link

No =)

@williamherry
Copy link
Contributor

#2905 check this fix

mshibuya added a commit that referenced this issue Feb 13, 2018
…_for_filtering_select

Fix #2398: Broken Client Side Validation for filtering select
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

8 participants