Skip to main content
aprild49548367
Known Participant
March 27, 2018
Question

How to require questions with Yes or No radio buttons be answered

  • March 27, 2018
  • 2 replies
  • 1556 views

I have created a form that includes two questions with Yes or No radio buttons for answers.  I would like to make them required so that the first question has to be answered before moving on to the next question.  Is there a way to do that?

Ex: Is the applicant is an individual?  Yes  or   No  (I have named this set of radio buttons "HMDA"). I don’t want people to tab through this question without answering it first.  Once it is answered I would like them to be directed to the next question which is "Is the applicant an entity?"  Yes   or   No (I have named this set of radio buttons "BeneficialOwner").

Thanks

This topic has been closed for replies.

2 replies

aprild49548367
Known Participant
March 27, 2018

Thanks for responding but I'm really a beginner with this.  Can you tell me what the JavaScript would say/look like?

aprild49548367
Known Participant
March 28, 2018

Below are the questions from my form.  I want to force the applicant to answer each question without being able to skip over them.  I wrote the below code but it doesn't work properly.  If the applicant tries to skip the first question an alert will appear letting them know they have to answer the question.  When they click ok to dismiss the alert - if they answer yes to the first question it works fine and they can move on to the second question.  However, when they click ok to dismiss the alert - if they answer No to the first question then it just makes the alert pop-up again before the applicant can move on.

When I try to apply the same script (with different field names) to the second question it wants to make the alert from the first question appear with the alert for the second question.     

Script for First Question:

if (getField("HMDA").value="Off")
{app.alert("If the applicant is an individual, is the collateral offered a
residential dwelling?  Please select
either Yes or No", 3);getField("HMDA").setFocus();}

Script for second question:

if (getField("BeneficialOwner").value="Off")
{app.alert("If the applicant is an individual, is the collateral offered a
residential dwelling?  Please select
either Yes or No", 3);getField("BeneficialOwner").setFocus();}

aprild49548367
Known Participant
March 29, 2018

Is the file being submitted back to you? If so, add this validation to the Submit button.


Unfortunately, it is not being submitted.  The applicant has to print and sign it. 

I did try a different route...  I made Yes the default answer in the first question and then added the script below to create a pop-up for the applicant to confirm their answer.  However, if they change their answer to No in the pop-up it didn't change the answer on the form.  Any suggestions on how to make it change the answer on the form if they change the answer in the pop-up?

var dialogTitle = "Please Confirm";

var defaultAnswer = "Yes";

var reply = app.response ("Please confirm that the applicant is an individual and the collateral offered is a residential dwelling.", dialogTitle, defaultAnswer);

Inspiring
March 27, 2018

You have to write some custom JavaScript code to test that the radio button does not have a value of "Off" and then if that is true unlock the next fields.

Disabling (graying-out) form fields with Acrobat 7 and 8