Announcement

Collapse
No announcement yet.

Javascript coding help

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Javascript coding help

    Hi. If anyone could help me I would greatly appreciate it. I have some code that I would like to know how to condense. Here is a sample of what I have:
    if (event.target.value=="Off") {
    this.getField("tfuinspection1").readonly = false;
    this.getField("tfuinspection1").value = " ";
    this.getField("tfuinspection2").readonly = false;
    this.getField("tfuinspection2").value = " ";
    this.getField("tfuinspection3").readonly = false;
    this.getField("tfuinspection3").value = " ";
    this.getField("tfuinspection4").readonly = false;
    this.getField("tfuinspection4").value = " ";
    this.getField("tfuvalue1").readonly = false;
    this.getField("tfuvalue1").value = " ";
    this.getField("tfuvalue2").readonly = false;
    this.getField("tfuvalue2").value = " ";
    this.getField("tfuvalue3").readonly = false;
    this.getField("tfuvalue3").value = " ";
    this.getField("tfuvalue4").readonly = false;
    this.getField("tfuvalue4").value = " ";
    this.getField("tfuvalue5").readonly = false;
    this.getField("tfuvalue5").value = " ";
    this.getField("tfuvalue6").readonly = false;
    this.getField("tfuvalue6").value = " ";
    } else {
    this.getField("tfuinspection1").readonly = true;
    this.getField("tfuinspection1").value = "N/A";
    this.getField("tfuinspection2").readonly = true;
    this.getField("tfuinspection2").value = "N/A";
    this.getField("tfuinspection3").readonly = true;
    this.getField("tfuinspection3").value = "N/A";
    this.getField("tfuinspection4").readonly = true;
    this.getField("tfuinspection4").value = "N/A";
    this.getField("tfuvalue1").readonly = true;
    this.getField("tfuvalue1").value = "N/A";
    this.getField("tfuvalue2").readonly = true;
    this.getField("tfuvalue2").value = "N/A";
    this.getField("tfuvalue3").readonly = true;
    this.getField("tfuvalue3").value = "N/A"
    this.getField("tfuvalue4").readonly = true;
    this.getField("tfuvalue4").value = "N/A"
    this.getField("tfuvalue5").readonly = true;
    this.getField("tfuvalue5").value = "N/A"
    this.getField("tfuvalue6").readonly = true;
    this.getField("tfuvalue6").value = "N/A"
    }

    I would like to know how to write it so it is more condensed then having to write out each form field that I have on my document. These are for when a checkbox is checked to N/A multiple form fields. Some are text fields and some are dropdown menus. Thanks for anyone that helps out.

  • #2
    Dear Austin C,

    Thanks for your post. What do you mean by that when a checkbox is checked to N/A multiple form fields?
    Would you please help to send us one PDF form sample with those Javascript codes included for us to take a closer look at first ,so that we will forward it to our
    developers to see if those JS codes could be condensed somehow.
    If it is inconvenience to upload the files here, you may email it to support@foxitsoftware.com (Attn:Lisa). And indicate this thread link. Thank you.

    Comment


    • #3
      Is it possible to make a section/ section of a pdf clickable?
      Example:
      ………. is the name of a boy?
      a. Harry
      b. Claire
      c. None of the above.
      See answer: D, Harry.

      I want the “see answer” to be a button which when clicked, displays the answer “D, harry”.
      How do I go about this?

      Comment


      • #4
        Dear Ola,

        Attached "JS demo.pdf"is a demo file for your reference,please open this PDF and click on the checkbox there to see if it it meet your requirements.I have also attached the JS codes in the attached screenshot.
        Attached Files

        Comment

        Working...
        X