Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
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

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
467
Translate
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

You can set the buttons also as readonly.

Translate
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

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.

Translate
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

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

Translate
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

Yes, my bad.  Radio buttons.

Translate
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

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.

Translate
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

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

Translate
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

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

Translate
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
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".

Translate
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