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 Validation] search selection dropdown with rule type 'empty' validates on form clear or form reset. #778

Closed
5t4r8ucK opened this issue May 28, 2019 · 3 comments
Labels
lang/javascript Anything involving JavaScript type/bug Any issue which is a bug or PR which fixes a bug
Milestone

Comments

@5t4r8ucK
Copy link

Bug Report

[Form Validation] search selection dropdown with rule type 'empty' validates on form clear or form reset.

Steps to reproduce

  1. Create a form with a search selection dropdown in it.
  2. Create validation rules for the field and search selection dropdown of type 'empty'.
  3. Create a button to clear/reset the form (or create a submit button with a call to clear/reset the form on submission)
  4. Fill in the form, including the search-selection dropdown.
  5. Press the clear/reset button (or submit the form if on submission the form clears/resets)

Expected result

If a form is cleared or reset then all the fields in the form, including the search selection dropdown, should clear their data and remove error messages.

Actual result

Instead of clearing the data from the search selection dropdown, like it does for the regular inputs, the form runs validation on the search selection dropdown and then displays an error.

Test case

https://jsfiddle.net/St4r8ucK/ukdLbe08/25/

Screenshot (when possible)

Capture

Version

2.7.5

@lubber-de lubber-de added the type/docs Anything which are related to the documentation label May 28, 2019
@lubber-de
Copy link
Member

lubber-de commented May 28, 2019

After looking at the code, it turns out the docs are not up to date.
The provided input field won't be correctly recognized as search input and the module always creates a second input field.

To fix this you have 2 options:

- remove the type=hidden and add class="search" to the input field
https://jsfiddle.net/sbk9w4dt/
~ or~
- remove the entire input field, it will be created by the module automatically
https://jsfiddle.net/sbk9w4dt/1/
[Edit]
I was talking nonsense again...

@lubber-de
Copy link
Member

🤔 mmh, tested again, my suggested fix is not accurate enough, the form validation won't find the input at all to validate it.... I think, we definately have to fix something here in the code. Also the docs are fine (the hidden input was a value holder only instead of meant to be used as search input, my fault..)

@lubber-de lubber-de added type/bug Any issue which is a bug or PR which fixes a bug lang/javascript Anything involving JavaScript and removed type/docs Anything which are related to the documentation labels May 28, 2019
@lubber-de
Copy link
Member

Finally fixed by #1092
See your adjusted jsfiddle here https://jsfiddle.net/y6qmp8bd/

@lubber-de lubber-de added the state/has-pr An issue which has a related PR open label Oct 13, 2019
@lubber-de lubber-de added this to the 2.8.0 milestone Oct 13, 2019
@lubber-de lubber-de added tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build and removed state/has-pr An issue which has a related PR open labels Oct 22, 2019
@y0hami y0hami closed this as completed in 1d69302 Nov 14, 2019
@y0hami y0hami removed the tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build label Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/javascript Anything involving JavaScript type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

No branches or pull requests

3 participants