Can I make a print button check a form to make sure all the required fields are completed before printing?
Views
Replies
Total Likes
1. Use regular button rather than print button provide in the library.
2. In the Click event of the button add validation code to make sure all the required fields are filled-in and then print if OK
Example: var allRequiredFlag = 0;
if (field1.isNull) {
allRequiredFlag = 1;
}
if (field2.rawValu == "") {
allRequiredFlag = 1;
}
// add as many as you need
// finally exicute the print code based one the Flag value
if (allRequiredFlag == 0) {
//good to print
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0);
}else {
xfa.host.message("Not all Required fields have data.");
}
Good luck,
Views
Replies
Total Likes
This is exactly what I have been looking for. However, could you or someone provide the steps to choosing a "regular button" and where to insert this code? I am using Acrobat Pro 9. Thanks in advance!
Views
Replies
Total Likes
Under Library>>Standard select "Button" which will give you Regular button. Of course you have options 1. Regular 2. Execute 3. Submit under Object>>Field>>Control Type.
Views
Replies
Total Likes
Thank you for the quick reply! OK so I inserted my button, clicked on the window menu and chose object. I verified that it was set to regular under control type but where do I insert the code?
Views
Replies
Total Likes
I am very happy to say that I have now discovered where to put the script. I have a few changes to make but I am well on the right track thanks to you! As you can tell I am new to LiveCycle Designer but am very please with all the possiblities it offers. Thank you!
Views
Replies
Total Likes