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

How to create a mandatory Yes or No answers by using Radio Buttons

jenice
Registered: Jul 15 2011
Posts: 3
Answered

At this time, I've created Yes/No Radio Buttons where the client can choose only one or the other, although I need to make the fields manadatory - they must choose Yes or No. Any suggestions? I have no experiece with JavaScript.

My Product Information:
Acrobat Pro 9.3, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
Accepted Answer
Mandatory in what sense? Although a field can be marked as required, this will only be enforced when submitting the form (either by email or to a web server). But it doesn't really apply to radio buttons or check boxes, since they always have a value, either their export value or "Off" if none in the group are selected. You cannot prevent the user from saving an incomplete form, but you can add scripting that will prevent them from continuing with the form until an item is selected in a radio button group.
jenice
Registered: Jul 15 2011
Posts: 3
Your suggestion is perfect! Thank you! Although, once again, I have no experience with JavaScripting. My thought:

If the Yes & No fields are left blank, and the client clicks on the SAVE button, a message would pop up andstate that you must complete one of the two options; and direct them back to that particular Yes/No question.Any scripting that you could provide would be really appreciated!!
try67
Expert
Registered: Oct 30 2008
Posts: 2398
So let's say the name of your radio button group is "Radio Button1". You can then add this script as the WillSave action of your file (it will NOT prevent the file from being saved, as previously mentioned):

if (getField("Radio Button1").value=="Off") {
app.alert("You should select either Yes or No!",3);
getField("Radio Button1").setFocus();
}

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
If you set the default to either the "Yes" or the "No" button being checked by default, there will be no "Off" condition.

George Kaiser