Hi All,
I am new to this technology and struck up with the below issue. Please guide me in finding a solution.
Scenario 1 (Creating new PDF):
I had created a PDF Acro form (NOT a XFA form) using LiveCycle designer. The form has a checkbox, textfield and button. On Click of the button (Save), I am doing the below validation; This validation is working fine. In the server side, I am using a Java (Servlet) to save the PDF to FileSystem.
********************
form1.#subform[0].Button1::mouseDown - (JavaScript, both)
if(CheckBox1.rawValue == 0) {
app.alert({
cMsg: "Warning! Enter the value for Checkbox",
cTitle: "Checkbox"
});
CheckBox1.border.edge.color.value = "255,0,0";
} else {
myDoc.submitForm({
cURL: "http://localhost:9080/FDF_Examples/SavePDFAction",
cSubmitAs: "XFDF"
});
}
*********************
Scenario 2 (Editing a Saved PDF):
I opened the above saved PDF in a browser. The checkbox in the PDF is displaying as "Checked". But
when I click the button (Save), the javascript displays my validation message "Warning! Enter the value for Checkbox".
Even though the checkbox is "checked", the javascript code "CheckBox1.rawValue" is returning a value (0).
When I deselect and select again the checkbox, the javascript code "CheckBox1.rawValue" is returning a value (1).
*********************
Is there any other way to find if the checkbox is selected? Please let me know your thoughts and suggestions. Appreciate your support.
Note to moderator: I had also posted the same topic under JavaScript anticipating some kind of help.
Subha.
if the CheckBox is checked but "CheckBox1.rawValue" is returning 1 then there is a problem with the form. This is not normal behavior. Sounds like the data model is not properly merged into the form model Try running this code after the document initialized.
xfa.form.remerge();
Your form submit does not submit the PDF file, it is sending the form data, in XFDF format to your Java Servlet. What is the Servelet sending back? XFDF is not the correct data format to be using with an XFA document, especially if it's dynamic. Submitting/recieving XFDF circumvents the data model. This combined with whatever is returned from the servlet may be corrupting the Data model so that the checkbox looked checked, but the underlying data is not.
*******************
BTW: Nobody is obligated to answer your questions. This is a free service provided by volunteers. Some get answered, some don't. Why don't you chip in and answer a few?
*****************
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/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script