Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Update method is not updating submit button disabled state #461

Closed
Dash92 opened this issue Dec 8, 2016 · 1 comment
Closed

Update method is not updating submit button disabled state #461

Dash92 opened this issue Dec 8, 2016 · 1 comment
Assignees

Comments

@Dash92
Copy link

Dash92 commented Dec 8, 2016

Currently I have a set of radio buttons that trigger bootstraps collapse method for a div which contains a few text inputs.
The collapse is triggered with jQuery and the update is triggered on Bootstraps hidden.bs.collapse event:
$("#rentingInfo").on('hidden.bs.collapse shown.bs.collapse', function(){ $("#whereForm").validator('update'); });

The text inputs that are shown are required if they are visible. I have edited the validator selector to:
Validator.INPUT_SELECTOR = ':input:visible:not([type="hidden"], [type="submit"], [type="reset"], button)'

So what should happen, is the form must be valid if the text inputs are hidden (which they are by default) and invalid if they are visible and empty.
As far as I can tell, the form does validate, however it does not toggle the submit buttons disabled state. IE: The submit button is enabled when the form is loaded as the text inputs are hidden by default. When I toggle the radio button, the text inputs are shown, but the button remains enabled, however, when I click on the submit button, it becomes disabled and highlights the fields as invalid. Now with the button in the disabled state, I toggle the radio button which hides the text fields, which makes the form valid again, but the submit button still remains disabled, however, when I click the disabled submit button, it enables it and submits the form sucessfully.

@1000hz 1000hz self-assigned this Dec 8, 2016
@1000hz
Copy link
Owner

1000hz commented Dec 8, 2016

I hadn't considered this. I'll make a change to run toggleSubmit() when you call .validator('update').

@1000hz 1000hz closed this as completed in 2f49477 Dec 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants