• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Radio button issues

New Here ,
Apr 05, 2018 Apr 05, 2018

Copy link to clipboard

Copied

Below are this the question from my form. I have a radio button Yes/No set (named HMDA) and I want to force the applicant to answer the question without being able to skip over it.  I wrote the below code but it doesn't work properly.  If the applicant tries to skip the 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 question my script works fine and they can move on to the next question on the form.  However, when they click ok to dismiss the alert - if they try to answer No to the question the alert appears again and they click ok to dismiss the alert then the No button will populate and then applicant can move on.

Script for my Question:

if(getField("HMDA").value=="Off")app.alert("If the applicant is an individual, is the collateral offered a residential dwelling? Please select Yes or No",1,0,"HMDA ERROR")

Also, how do I get rid of the Warning: "JavaScript Window" on my alert?

TOPICS
Acrobat SDK and JavaScript

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 05, 2018 Apr 05, 2018

The error message is an Adobe's anti-spoofing mechanism.  In order to get rid of it the code has to be run from a privileged (trusted) location,i.e. not a document script.

You can read more about trust and privilege here:

Trust and Privilege in Acrobat Scripts

Votes

Translate

Translate
Community Expert ,
Apr 09, 2018 Apr 09, 2018

Copy link to clipboard

Copied

There is a way to do this, it's just complicated. For example, you can add On Focus script to every field on the form.

This script would save the name of the field that has the focus and use this saved value to decide whether or not the field focus is changing on a required field. For example, if the saved name and the current name are the same it would do nothing. But if they are different and the saved name was a required field, and didn't have a value, it displays the warning.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

Can you provide me an example of what the script would say?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

This is not a simple script. Would you be willing to pay for it?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 10, 2018 Apr 10, 2018

Copy link to clipboard

Copied

LATEST

Thanks for your help with this but I figured out how to make the app.response box actually populate the field with with the response from the alert.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 06, 2018 Apr 06, 2018

Copy link to clipboard

Copied

Yes, but "tab through a question" doesn't mean anything when the user can just click past it. You need to move from the concept to exactly what you want to happen, realising that PDF forms haven't been designed to enable this easily. You have to forbid actions in all successor fields after checking conditions. Consider too that fields have more than one action type, choose carefully.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines