Skip to main content
N8-K
Participating Frequently
July 30, 2018
Answered

Conditional Read-Only Field Not Accepting User Input

  • July 30, 2018
  • 1 reply
  • 827 views

I have a field that switches from calculating to non-calculating based upon conditions. The calculating works perfectly and the clearing out of the field and setting to required works perfectly; however, after entering a new value and clicking out of the field, the value entered is cleared out. Any recommendations to resolve?

\\ Radio Button Choice for No: "C2b-Choice_MinBB"

if (aType !== "New Hire") {

  this.resetForm(["C4a-CalcSalary"]);

  this.getField("C4b-NewSalary").required = false;

  this.getField("C4b-NewSalary").readonly = true;

}

else if (aType == "New Hire") {

  this.resetForm(["C2a-CurrentSalaryChangePercent","C4a-CalcSalary"]);

  this.getField("C4b-NewSalary").required = true;

  this.getField("C4b-NewSalary").readonly = false;

}

\\ Field causing grief when radio button "No" is selected: "C4b-NewSalary"

var aType = this.getField("1-ActionType").value;

var minBB = this.getField("C2b-Choice_MinBB").value;

var grade = this.getField("B3a-CPBB").value;

if (aType == "New Hire" && minBB == "C2b-MinN") {

       event.source = event.target;

} else if (aType == "New Hire" && minBB == "C2b-MinY" && (grade == "NH-01" || grade == "NJ-01" || grade == "NK-01")) {

       event.value = 18785;

} else if (aType == "New Hire" && minBB == "C2b-MinY" && (grade == "NH-02" || grade == "NJ-02" || grade == "NK-02")) {

       event.value = 28945;

} else if (aType == "New Hire" && minBB == "C2b-MinY" && (grade == "NK-03")) {

       event.value = 39707;

} else if (aType == "New Hire" && minBB == "C2b-MinY" && (grade == "NJ-03")) {

       event.value = 43857;

} else if (aType == "New Hire" && minBB == "C2b-MinY" && (grade == "NH-03" || grade == "NJ-04")) {

       event.value = 63600;

} else if (aType == "New Hire" && minBB == "C2b-MinY" && (grade == "NH-04")) {

       event.value = 89370;

}

This topic has been closed for replies.
Correct answer Bernd Alheit

Shared Files - Acrobat.com


The calculation script at field "1-ActionType" resets the field "C4b-NewSalary".

Use a validation script for the field.

1 reply

Bernd Alheit
Community Expert
Community Expert
July 30, 2018

Where did you place the code?

N8-K
N8-KAuthor
Participating Frequently
July 30, 2018

I have the radio button script under Actions > Mouse Up > Run a JavaScript and the script on the actual field in question ("C4b-NewSalary") is under Calculate > Custom calculation script.

Bernd Alheit
Community Expert
Community Expert
July 30, 2018

Can you share the form?

You can use Tools > Send & Track and post the link.