These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

required radio buttons

sab
Registered: Jul 16 2007
Posts: 5

hi how do you make a radio button and have it required eg
gender : male or female

i have the 2 radio buttons setup as gender the export values are male, female
and both buttons have the required field checked but when you goto save the file(through reader) it say that both button need to be check to continue

how do you set it up so that it one or the other and the field is required, they have to choose male or female to continue

thanks
wayne

scottsheck
Registered: May 3 2007
Posts: 138
Search your help for 'Exclusion Group'. The two radio buttons must be in a single Exclusion Group.
sab
Registered: Jul 16 2007
Posts: 5
ok opened acrobat 8 searched for Exclusion groups. nothing found
im using acrobat 8 pro on mac if this makes a difference?
scottsheck
Registered: May 3 2007
Posts: 138
Maybe you are using Acrobat forms instead of Designer. In the Help of Designer, it explains it. I'm not familiar with Acrobat forms.
sab
Registered: Jul 16 2007
Posts: 5
yes im use acrobat forms. do you know anyone that is familiar with acrobat forms? or where i mite go?
buddenceq
Registered: Dec 3 2007
Posts: 17
I'm also trying to figure it out as well. I am using a Acrobat forms and a mac as well. Can anyone please help???
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Since the "required" property for check boxes or radio buttons requires a response on the widget level, individual field, and one can not set the "required" property on a widget level, one will need to create a script to set or unset the "required" property for check boxes and radio buttons when an item is selected or there is no item sleeted. Since this action will need to be applied to each check box or radio button group, one could write a document level JavaScript or function.

A check box or radio button group will have the export value of a selected button or a value of "Off" when no item has been selected. This fact can provide the information to create the statement for an "if" statement for a general test to see if an item has been selected or not.

Using a document level function to test a value against "Off" and return the logical result could be used to set the "required" property:

// Document level function
function ButtonRequired(cValue)
{
/*
Function: return result of comparison of passed value to 'Off"
Input: cValue
Return; logical result of comarsion of passed value to "Off"
*/
if (cValue != "Off") {
return false;
} else {
return true;
}

return;
}
// end function

The on blur action could then run the following JavaScript:

/*
on blur action:
set required property on comparison of the field value to "Off"
*/
this.getField(event.target.name).required = ButtonRequired(event.value);
// end on blur action

George Kaiser

buddenceq
Registered: Dec 3 2007
Posts: 17
Thanks! it worked. Just one more thing, I have one question on my form that has multiple radio buttons for the same question. (not just 2) How can I apply this javascript so that it works with more than 2?
buddenceq
Registered: Dec 3 2007
Posts: 17
Nevermind it works as is. But now I have a last question! :)

I want when I hit my reset forms button for all the buttons to default back to required.
pribeiro
Registered: Aug 18 2009
Posts: 1
Thank you thank you thank you - I've been struggling with radio buttons and how to make each set required, and your script and explanation worked perfectly.

thank you!
scribbleit
Registered: Jul 21 2010
Posts: 21
i think this will work for me, but i still have no idea how to do it. my radio buttons are Yes and No answers and there are several of them. how can I apply this to my document?

i know basically NOTHING about javascript, so even with all the code up there, it makes no sense to me.

i'm using acrobat 8 pro and i'm on a mac.

thanks!