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

Disabling button upon Submit on AcroForm

OlaSchool
Registered: Mar 7 2008
Posts: 3
Answered

Using Acrobat 8 (Not LC)

I am trying to disable a submit button upon being invoked in order to prevent multiple submissions. I'm handling the submit action and data validation in javascript, so I just need to know what property on the button object to set in order to make it behave as a disabled button. The target of the submission is a web application that can take some time to process before responding to the request, so the liklihood of a double-submission is very high.

Curiously, when I set the Read Only property to true on a button through the UI, it behaves exactly the way I'd want the disabled button to work. However, the field.readonly property always resolves to true through the programmatic interface, as well as the field.access property always resolves to readOnly. It seems like the UI control abstracts some other properties of the object interface, and I can't find anything in the documentation that steers me in the right direction. Please advise how I can set the properties in javascript to make a button behave as if I had set the Read Only checkbox to true through the UI.

Thanks!

My Product Information:
Acrobat Pro 8.1.1, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Have you read this article?

http://www.acrobatusers.com/tutorials/2007/js_disabling_fields/

You may also want to consider setting the ReadOnly property on the MouseDown event.

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

OlaSchool
Registered: Mar 7 2008
Posts: 3
It turns out that the code was not working because I was casing the property incorrectly as "readOnly" instead of "readonly". There seems to be some inconsistency with the property name across different object types. However, it works as expected once I followed your sample code, which includes the small-cased name.

Thanks!