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

data-validation-depends-on-value only removes error message and styling for last associated input #594

Open
jbmorganQAA opened this issue May 9, 2017 · 2 comments

Comments

@jbmorganQAA
Copy link

jbmorganQAA commented May 9, 2017

If multiple inputs depend on the value of one parent input, only the last of the dependants inputs gets its error styling / messaging removed if the parent input's value is changed.

For example:

<select id="foodType" name="foodType" data-validation="required" data-validation-error-msg="<strong>Food Type</strong> is required.">
	<option value="">Please select...</option>
	<option value="Pizza">Pizza</option>
	<option value="Burger">Burger</option>
	<option value="Curry">Curry</option>
	<option value="Chips">Chips</option>
</select>
<!-- Dependent inputs: -->
<input id="topping1" name="topping1" type="text" data-validation="required" data-validation-depends-on="foodType" data-validation-depends-on-value="Pizza" data-validation-error-msg="<strong>Topping 1</strong> is required."/>
<input id="topping2" name="topping2" type="text" data-validation="required" data-validation-depends-on="foodType" data-validation-depends-on-value="Pizza" data-validation-error-msg="<strong>Topping 2</strong> is required."/>
<input id="topping3" name="topping3" type="text" data-validation="required" data-validation-depends-on="foodType" data-validation-depends-on-value="Pizza" data-validation-error-msg="<strong>Topping 3</strong> is required."/>

If "Pizza" is selected and the form then validated, topping1, topping2 & topping3 will become required and get the error class and message (correct).

If the foodtype select is changed to another option, only topping3 gets its error class and message removed (incorrect).

Please see this JSFiddle: https://jsfiddle.net/28tfq1dn/

@victorjonsson
Copy link
Owner

This now behaves as expected in version 2.3.63

@jbmorganQAA
Copy link
Author

That's awesome!
Thank you so much for replying and fixing so quickly!

Great plugin :)

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

No branches or pull requests

2 participants