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

How to validate collapsed and disabled fields once expanded and enabled? #114

Closed
tinyfly opened this issue Apr 30, 2012 · 5 comments
Closed

Comments

@tinyfly
Copy link

tinyfly commented Apr 30, 2012

I have a form that has a fieldset containing fields for billing info. By default, this fieldset is hidden and the fields within it are disabled. When a checkbox is checked the fieldset is shown and the fields are enabled.

My problem is, I cannot get the validation to occur on those fields. I've tried everything I can think of to get the validation to fire but no luck. I thought data-dependent-validation was the key but that only seems to work if the fields are not disabled to begin with.

Any help on how to validate expandable/collapsable groups of fields when the submit button is pressed would be much appreciated.

@aFarkas
Copy link
Owner

aFarkas commented Apr 30, 2012

Does this help?:
http://jsfiddle.net/trixta/gNrgG/

@tinyfly
Copy link
Author

tinyfly commented Apr 30, 2012

Not exactly but as I was creating a jsFiddle to show you the problem I figured out what the issue was.

I have a clearForm plugin where I clear all the form fields and that was causing the validation to stop working. I know this is a bit outside the scope of your plugin but could you take a look and see if you know why the clearForm bits would cause this?

See clearForm being called in the disableFields function:
http://jsfiddle.net/tinyfly/dj3vw/

@aFarkas
Copy link
Owner

aFarkas commented May 1, 2012

Wow, you found a new webkit bug. I will try to detect this bug and fix this inside of webshims + fill an issue in the webkit bugtracker.

Here is how you can workaround this issue:

Currently you are setting an input disabled and then reset the value. Simply change this order. First reset the value second disable the input.

here is your changed fiddle: http://jsfiddle.net/dj3vw/14/

@tinyfly
Copy link
Author

tinyfly commented May 1, 2012

Perfect. Thank you very much.

By the way, thanks for creating Webshims. It is extremely useful and has made my current project much easier.

@tinyfly tinyfly closed this as completed May 1, 2012
@aFarkas aFarkas reopened this May 2, 2012
aFarkas pushed a commit that referenced this issue May 22, 2012
@aFarkas
Copy link
Owner

aFarkas commented May 25, 2012

@aFarkas aFarkas closed this as completed May 25, 2012
aFarkas pushed a commit that referenced this issue Jun 1, 2012
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

2 participants