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).
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!
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
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.
Copy link to clipboard
Copied
The value of unchecked checkboxes is "Off", not "off".
Copy link to clipboard
Copied
Thanks, Bernd. I forgot JavaScript is case sensitive. I updated the formulas, although it didn't affect the outcome.