Highlighted

Manual Entry Not Visible in Overwritten Field

New Here ,
Oct 08, 2020

Copy link to clipboard

Copied

So, I've used a script posted by Max Wyss that allows me to overwrite a field that contains a calculation (using a control checkbox that removes read-only when it is checked). The script works, however after I check the control box, what ever value I type into the field goes invisible once I hit return. The value is there because it shows up in the grand total at the bottom of the page. Is there a trick to making the overwriting entry visible? I'm pasting Max's original post here:  

 

Let's assume that the field to be made overwriteable is called "myResult", and the controlling checkbox is called "myResultCtrl".

 

The checkbox will get the following script in the mouseUp event:

 

if (event.target.value == "Off") {

this.getField("myResult").readonly = true ;

} else {

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

}

 

 

In the calculation involving the myResult field, you will add the following structure (you may have to adjust it for the calculation)

 

if (this.getField("myResultCtrl").value == "Off") {

// regular calculation code for field myResult comes here

} 

And that should get you closer to the intended result.

Hope this can help.

By Max Wyss   

TOPICS
PDF forms

Views

25

Likes

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

Manual Entry Not Visible in Overwritten Field

New Here ,
Oct 08, 2020

Copy link to clipboard

Copied

So, I've used a script posted by Max Wyss that allows me to overwrite a field that contains a calculation (using a control checkbox that removes read-only when it is checked). The script works, however after I check the control box, what ever value I type into the field goes invisible once I hit return. The value is there because it shows up in the grand total at the bottom of the page. Is there a trick to making the overwriting entry visible? I'm pasting Max's original post here:  

 

Let's assume that the field to be made overwriteable is called "myResult", and the controlling checkbox is called "myResultCtrl".

 

The checkbox will get the following script in the mouseUp event:

 

if (event.target.value == "Off") {

this.getField("myResult").readonly = true ;

} else {

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

}

 

 

In the calculation involving the myResult field, you will add the following structure (you may have to adjust it for the calculation)

 

if (this.getField("myResultCtrl").value == "Off") {

// regular calculation code for field myResult comes here

} 

And that should get you closer to the intended result.

Hope this can help.

By Max Wyss   

TOPICS
PDF forms

Views

26

Likes

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
Oct 08, 2020 0
Engaged ,
Oct 08, 2020

Copy link to clipboard

Copied

You don't need script in checkbox, use this as Custom Calculation Script of "myResult" field:

 

event.value = here goes your calculation;
event.rc = this.getField("myResultCtrl").value == "Off";
event.target.readonly = event.rc;

Likes

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
Reply
Loading...
Oct 08, 2020 0