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

I have already written script for disabling the signature field until 5 other fields have been completed. But I don't know how to do that with 5 buttons I have.

Participant ,
Aug 03, 2017 Aug 03, 2017

Copy link to clipboard

Copied

This is my current script:

if(event.value != ""

&& this.getField("Name").value != ""

&& this.getField("Phone Number").value != ""

&& this.getField("Email Address").value != ""

&& this.getField("Directorate").value != "Select from Dropdown") {

this.getField("User's Signature").readonly = false;

} else {

this.getField(User's Signature").readonly = true;

}

TOPICS
Acrobat SDK and JavaScript , Windows

Views

324

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 ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

You can set the buttons also as readonly.

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
Participant ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

My apologies, my question wasn't clear.  The user will need to answer the first 5 "fillable" questions (One of them being a dropdown menu) and the other 5 "button" questions, they need to select either YES, NO, or N/A.  Once they've completed all 10 questions, the digital signature button will be available.

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 ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

Do you mean "radio-buttons"? Buttons don't have a selectable value...

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
Participant ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

Yes, my bad.  Radio buttons.

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 ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

OK, the default value of a radio-button group when no specific field in it is selected is "Off", so you can just add it to your current code, just like the text fields or drop-downs.

A better way, IMO, is to compare the value to the default value, instead of hard-coding those values into your code. If the value equals the defaultValue, that means the field has not been filled in.

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
Participant ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

Can you give me an example of your opinion?  I'm not sure what you're talking about.

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 ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

This is what I mean:

if(event.value != ""

    && this.getField("Name").valueAsString != this.getField("Name").defaultValue

    && this.getField("Phone Number").valueAsString != this.getField("Phone Number").defaultValue

    && this.getField("Email Address").valueAsString != this.getField("Email Address").defaultValue

    && this.getField("Directorate").valueAsString != this.getField("Directorate").defaultValue) {

this.getField("User's Signature").readonly = false;

} else {

this.getField("User's Signature").readonly = true;

}

Edit: Code fixed

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
Participant ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

LATEST

Very good!  Thanks for your help on this!  I was able to get every field working properly and the form is a hit in the office, haha!  Thanks again!  I'll post my final code later.  I did notice, for anyone that may copy this...Line 8 (if no one has noticed yet), I forgot to input a beginning quote in front of "User's".

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