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

"checked" qualifier doesn't work on radio buttons #13

Open
srsanborn opened this issue Nov 18, 2014 · 4 comments
Open

"checked" qualifier doesn't work on radio buttons #13

srsanborn opened this issue Nov 18, 2014 · 4 comments

Comments

@srsanborn
Copy link

The "checked" qualifier doesn't work on radio buttons as documented.

@srsanborn
Copy link
Author

For what it's worth, my current workaround has been to use the values qualifier on a set of radio buttons, like so:

$('#text_field').dependsOn(
{'input[name="radio_button_set"]': {values: ['one']}},
{hide: false}
);

...but it would be nice to simplify this to depend on the checked state of a specified element vs value-based dependency.

@dstreet
Copy link
Owner

dstreet commented Nov 18, 2014

Thanks for pointing that out. The documentation is incorrect. The checked qualifier is meant to only work on checkboxes. I will consider allowing this qualifier to be used for radio buttons, but since a radio group is meant to represent multiple states of a single property, the values qualifier best fits this need.

@dennisdupont
Copy link
Contributor

This works if you want a specific value, but not if you want to check against unchecked. Rather than have to repeat all possible values (a maintenance headache and not very DRY), I should be able to use {not: [undefined]} (although I'm not sure jquery will normalize all browsers to undefined - better to check for null or empty string also).

@lajlev
Copy link

lajlev commented Nov 19, 2015

Please update documentation with this for radio buttons. Thanks to @srsanborn

$('#some-element').dependsOn({
  'input[name="radiogroup"]': { values: ['other'] }
});

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

4 participants