Uncheck a radio button during "onLoad" script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2009 12:54 PM
I have a series of radio buttons that I need make sure are NOT CHECKED when a form is initially displayed.
Would anyone be willing to share some code that I can use during an "onLoad" script to uncheck any radio buttons that are checked by default? Or maybe there is a setting that I'm overlooking that will prevent a default check ..
Any help very much appreciated ..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2009 01:11 PM
You can set the default value in the dictionary of that field to false and it should be unchecked. No need to run a script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2009 06:48 AM
Thanks. You got me on track.
I couldn't seem to find references in the dictionary to my radio button variable names. But I did set the "default" value for the variable to (null) which got me what I was looking for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2009 07:09 AM
null will work, and actually any value that doesn't match one of the choices will work. In this case null is not really null it's just another string value.
Where this is important is when you try to make the variable mandatory. If you default to anything then the mandatory check thinks you have a value, and you really do. If you don't set a default you get the first option selected.
Here's a client script I'm using to really clear the value onLoad to reverse the default value. It's still not the cleanest option but until we come up with a better option, like a variable parameter, then it should do the trick.
var var_ctrl = g_form.getControl('variable_name');
var_ctrl.value = '';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2009 07:18 AM
That makes a lot of sense. THANKS for describing the behavior of the default value. Oddly enough, I was wrestling with an issue (this morning!) with a "mandatory" item not behaving as expected. My use of the default value "null" was, in fact, causing the problem.
THANKS.