Help overriding cell but option to retain original formula

New Here ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

We have an estimate form our PM's use when creating a budget for a project.  The contingency and labor cells are calculated using a formula, but sometimes they want the ability to override the cells to get to a certain total (i.e. department has a total budget of $15K). The cells highlighted are the ones I need override capabilities. (For the % cells, I took the advice on here and if a 0% is entered, the text goes white, so it looks like the cell is blank). 

Cathy25079790wsbz_0-1656614591692.png

I have no JavaScript experience, so I'm having some trouble adapting some of the previous recommodations to my situation.

 

Original formulas for these cells were in the "calculated" tab under "Simplified field notation" box. First line is for the Contingency Amount (cell is called ContingencyAmountEst1) and second line is for PM Amount (cell called PMAmountEst1) :

       Subtotal_Est1*Contingency1

and

       (Subtotal_Est_1+ContingencyAmountEst1)*PMLaborPercent1

 

On one of the responses, it was suggested to create a check box to toggle the feature on/off. I created one and under the "Actions" tab, I have the check box JavaScript as (hoping one check box can override both cells - checkbox is called ReadOnly1) :

if (event.target.value == "Off") {this.getField("ContingencyAmountEst1").readonly = true ;} else {this.getField("ContingencyAmountEst1").readonly = false ;};

if (event.target.value == "Off") {this.getField("PMAmountEst1").readonly = true ;} else {this.getField("PMAmountEst1").readonly = false ;}

For the ContingencyAmountEst1, I altered the formula to this JavaScript. I still have this under the "Calculate" tab, "simplified notation" box.

if (this.getField("ReadOnly1").value == "off") {// Subtotal_Est_1*Contingency1}

 For the PMAmountEst1, I did something similar.

if (this.getField("ReadOnly1").value == "off") {//((Subtotal_Est_1+ContingencyAmountEst1)*PMLaborPercent1)}

 

My problem is while it allows me to override the cells when the ReadOnly1 checkbox is checked, when I uncheck it, it does not revert back to the original formula (i.e. in case they change their mind or check it by accident).  I also don't know if I have the formulas for the two fields in the right spot. When I've tried to move them to the "Actions" or "Validate" tabs to see if that would help, I got formula error messages.  One other post mentioned the original formulas for the cells needed to be validated to retain it, but since I don't know JavaScript, I couldn't adapt it to suit my situation.

 

Any help would be appreciated. Right now I'm playing hot potato with my IT department and I'm the potato...we don't have anyone versed enough in JavaScript and Adobe to help me.  Thank you in advance!

 

TOPICS
How to

Views

50

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
community guidelines
Community Expert ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

When you post a question you always need to tell the Adobe program you are using
There are MANY programs in a full subscription, plus other non-subscription programs
Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum

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
community guidelines
New Here ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Thank you, John. I am using Adobe Acrobat Pro 2017. Sorry. Forgot to mention that and I can't figure out how to edit my original post.

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
community guidelines
Community Expert ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

The value of unchecked checkboxes is "Off", not "off".

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
community guidelines
New Here ,
Jul 01, 2022 Jul 01, 2022

Copy link to clipboard

Copied

LATEST

Thanks, Bernd. I forgot JavaScript is case sensitive. I updated the formulas, although it didn't affect the outcome.

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
community guidelines