These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Remove warning prompt for calculations override

Formfingers
Registered: Feb 7 2007
Posts: 90
Answered

In my numeric fields - all of which are set to "calculated, user can override" - it prompts the user "are you sure you want to modify this field?" whenver they try and enter numbers into the table.

I'd like to remove this warning prompt altogether. The XML source currently reads: . There is nothing in my Override Message: in my Value tab.

Where/how to change this to remove this annoying prompt box?

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Supposidly, according to the documentation, you should be able to set the "override" attribute to "ingore" and the this will allow the user to silently override the calculated value. However I tested it and it doesn't work in Acrobat 8.12 :(

Another option is to provide the user with a check box for turning calculations on and off, so they have to deliberatly choose to override the calculation. You force the calculation off by setting "override" to "disabled".

For example:

SubForm.calcField.override = "disabled";


Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Formfingers
Registered: Feb 7 2007
Posts: 90
Thanks aokamoto! I tried your suggestion and left just the quotes in place. However, when I try testing the field, it gives me a halt box (the "X") saying "You are not allowed to modify this field."

No options, it just clears the number I entered.

Any other suggestions?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Angie, I tried your solution and Acrobat 8.12 defaulted the override value to "error". I haven't tried it in Acrobat 9. Does it work there?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Formfingers
Registered: Feb 7 2007
Posts: 90
Just an FYI, I've tried a variety of words too...
"accept, ignore, hidden, off, true, etc." I've tried deleting this string completely. Nothing has fixed the issue though...
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The [url=http://partners.adobe.com/public/developer/xml/topic.php]XML Forms Object Model Reference[/url] provides a listing of all the acceptable options for the "override" attribute. The only thing I've found that works is setting it to "disabled" from another script.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Nope, tried that one too:( Acrobat allows me to enter data, but then when I hit return it pops up an error message, "You are not allowed to enter data into this field". And then the calculated value is restored.

This is on the edge stuff. You have two situations that are directly opposed to each other, the user entering data and a forced calculated value. Which one gets presidence, under what conditions? How do you resolve it? Since there are several unclear aspects this is exactly the sort of thing that's implemented differently in different versions of Acrobat. Hence the failure of the "ignore" value to work correctly.

In situations like this, where Acrobat is whishy-washy, and there are many, I strongly recommend writing your own code that provides explicit control.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Formfingers
Registered: Feb 7 2007
Posts: 90
Thank you both for testing this out! I'm glad it's not just me it isn't working for!

Thomp - is there a work-around code that could work for this? I'm not clear on what I need to type out/say for it to work. I have about 20 calculated numeric fields in my table, all of which (obviously) generate this warning.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
It has always seemed odd to me that Designer allowed you to create calculated fields whose value could be overridden by a user. I usually try to avoid calculated fields for performance and other reasons, and when I want to populate a field with a programmatically determined value, I call a routine that sets the field value from the Validate events of the dependent fields. When any of the values of the dependent fields change, the "calculated" field value is updated.

George
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This is my test, Say that your field is named "MyField" and it's in a subform named "MySubF". Add a check box to the form labeled "Disable calculations and allow manual entry". Set My Field to Calculate/Read Only

In the click event for the check box use code something like this
if(this.rawValue == 1){MySubF.MyField.access = "open";MySubF.MyField.calculate.override = "disabled";}else{MySubF.MyField.access = "readOnly";MySubF.MyField.calculate.override = "error";}

Unfortunately this doesn't seem to work as far as turning the calculations back on. Once they are disabled they stay disabled until the form is reopened. I'm sure there must be a way to turn calcs back on but I don't know it. Perhaps we can get Stefan in on this one. He'll know.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

sconforms
Expert
Registered: Jul 10 2007
Posts: 92
I think the problem here is that once you type into the calculated field, Acrobat flags the field as having an override value and it doesn't matter what you put in there, numeric or even null, simply restoring the access and calculate override properties won't re-establish the dependency of this field on some other field (which is what you get when you specify a Calculate script -- you create a dependency for some field on some other field(s)).

To restore the dependency after typing into the calculated field to specify an override, you need to reset the field by using the xfa.host.resetData() method. Based on Thom's test script from above, in the "else" case, you would add the following line:

xfa.host.resetData(MySubF.MyField.somExpression);

That will remove the override value and cause the Calculate script to re-execute based on dependent field values.

It should be noted that what makes a field be a "calculated field" is simply the presence of a Calculate script. The access and calculate.override properties don't make the field be or not be "calculated". They just control the level of interactivity that the user can have with the field.

Designer exposes two configuration of access control for calculated fields:

1. "Calculated - Read-only" -- This sets field.access to "readOnly" (to prevent user interaction) and leaves the field.calculate.override empty which means it defaults to "error" which would result in Acrobat showing an error message and ignoring user entry upon typing into the field however you don't see this because the field is read-only.

2. "Calculated - User Can Override" -- This sets field.access to "open" (meaning the user is free to type into the field) and sets field.calculate.override to "warning" which means that if you type into the field, Acrobat will warn the user of the override to a calculated field and, if the user chooses to override the value, Acrobat will let the user type into the field at which point that field's value will be "locked" to the user's override value.

Stefan Cameron obtained his bachelor's degree with Honors in Computer Science at the University of Ottawa and is a Computer Scientist working on Adobe's LiveCycle server products, in particular on LiveCycle Designer ES for the past 5 years.

Formfingers
Registered: Feb 7 2007
Posts: 90
sconforms - Thank you for your reply!
I guess if I have to live with the warning prompt, so be it - it's just an extra click to eliminate. The principal is what bugs me; it should be editable!

If I dare to mess with editing the script, do I place the if/else statement Thomp provided above combined with your xfa.host.reset example after my calculation script? Or does it need to go into a different event altogether?

Does anyone know if Adobe intends on allowing users to fix this/select something else in a later version?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Thanks Stefan, Excellent Information!! I don't think I could found that in the documentation.

Ok, so I tested this out and it works like a charm. I placed the script below in a check box click event, although it could be done in serveral ways. For example, just the "Restore Calculation" part could be placed in a regular button next to the field. And the field set to "Calculated - User Can Override". When the user tries to enter data they get the warning box. But then later they can restore the calculation by a click on the button.

In my example the field was set to "Calculated - Read-only" and I use a check box to explicitly turn user entry on and off. The warning box never appears
if(this.rawValue == 1){// This code Allows Manual Entry when check box is turned on Name.caption.value = "Re-Enable Calculation";Name.access = "open";Name.calculate.override = "disabled";}else{// This code blocks Manual Entry and restores the calculation//  when the check box is turned offName.access = "readOnly";Name.calculate.override = "error";xfa.host.resetData(Name.somExpression);}

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script