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

Once a dropdown is set to readonly I need a button to be hidden, how can I do this?

New Here ,
Mar 25, 2016 Mar 25, 2016

I have tried everything and can't get it to work. Here is one that I tried:

var HourField = this.getfield("Hours");

if (HourField.readonly == true){

  this.getfield("Submit Button").display = display.hidden;

}else{

  this.getfield("Submit Button").display = display.noPrint;

}

TOPICS
Acrobat SDK and JavaScript , Windows
687
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

correct answers 1 Correct answer

Community Expert , Mar 25, 2016 Mar 25, 2016

But it probably doesn't trigger the calculation script... Why not simply

add it to the Signed event of the signature field?

On Fri, Mar 25, 2016 at 5:01 PM, billyc35864548 <forums_noreply@adobe.com>

Translate
Community Expert ,
Mar 25, 2016 Mar 25, 2016

This code looks fine... Where exactly did you place it, though?

Also, do you see any error messages in the JS console when you run it?

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 ,
Mar 25, 2016 Mar 25, 2016

Correction, I've spotted an error. The name of the function is "getField", not "getfield".

If you check the JS console then you should see an error message that says something like getfield is not a known function...

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
New Here ,
Mar 25, 2016 Mar 25, 2016

Thank you for the quick response! I had placed it in the custom calculation script, under the Calculate tab. I will try your correction and get back with you.

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
New Here ,
Mar 25, 2016 Mar 25, 2016

It doesn't work when I set the field to read only by signing the document. (The signature sets the Hours dropdown menu to "readonly" and is supposed to make the submit button hidden).

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 ,
Mar 25, 2016 Mar 25, 2016

But it probably doesn't trigger the calculation script... Why not simply

add it to the Signed event of the signature field?

On Fri, Mar 25, 2016 at 5:01 PM, billyc35864548 <forums_noreply@adobe.com>

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
New Here ,
Mar 25, 2016 Mar 25, 2016
LATEST

Thank you for the answer, I just added this to my signed script as you suggested:

//Sets everything as read only

for (var i=0; i<this.numFields; i++) {

    var f = this.getField(this.getNthFieldName(i));

    if (f==null) continue;

    f.readonly = true;

}

//Sets my Submit Button as hidden

this.getField("SubmitButton").display = display.hidden;

// Make a few fields read/write again after the "Nuke all" code above made everything readonly

this.getField("TrainingReportUpdated").readonly = false;

this.getField("PCard").readonly = false;

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