Alert user when saving PDF if required fields are empty/null

Greetings,
I've read a fair number of threads on this topic. I am not trying to force the user to stay in a field or otherwise be annoyed. I would just like to alert the user when they save the PDF if there are required fields that have not been filled out. The alert message would simply be a polite reminder to complete the form before sending.
I'm using Acrobat XI Pro.
1) Is the Other Tasks/Set Document Actions/Document Will Save the correct place to use a script in this case?
2) Would the script need to check each required field by name? Or is there a way to reference all required fields in the document?
3) I've seen some examples like this:
f = getField(event.target.name)
if (f.value.length == 0)
    f.setFocus()
    app.alert("This field is required. Please enter a value.")
However it has some issues with respect to closing the alert dialog and so forth. Can anyone provide a sample script to get me started?
Thanks!

Exactly how you check a field for being empty depends on what type of field it is. For text fields, you should get the field's value as a string and compare it to an empty string, something like:
var val = getField("Text1").valueAsString;
if (val) {
    app.alert("Field is not empty");
If there is a default value that needs to be changed, you would compare to the default value:
var f = getField("Text1");
var val = f.valueAsString;
if (val !== f.defaultValue) {
    app.alert("Field value is OK");
For check boxes and radio buttons, you'd compare to the string "Off", which means none in the group is selected.
For dropdowns (combo boxes) and list boxes, there is normally one value selected, so you would have to get the value and check against the default value (or something else) to see if the field is properly filled in.
You could place the script there, but I usually use a separate button that I encourage the user to click in order to check the field. The problem with using the Will Save event is you can't prevent the save from happening.
The script can loop through all of the fields (and test all required ones), or you could set up an array of field names to check.

Similar Messages

  • How to block the 'save' function when the required fields are not filled?

    Hello, Everyone
    I am new for this scripting. My question is:
    How to block the 'save' function when the required fields are not filled?
    I designed a PDF file with some required fields and I do not want the user to save the document until all required fields are filled. My idea is to write some scripts in Willsave method like:
    if (this.getField("Family Name").value == ""){
    app.alert('You should fill the Family Name field firstly!');
    But I do not think it works as finally the document is saved after all.
    Please help me on that!
    So much thanks.

    Dear Randybearwang,
    I am a Rocky myself and I know how though it is to establish some good codes. Since I created some forms with validation options myself I might have a code for you. The code also creates an alert box (Yes/no option) if the user chooses yes the form will be validatet, if he chooses "no" the alert window will be closed.If  everything is filled out correctly the form will be saved otherwise the textbox will be higlighted and gets focus.
    If you need further assistance , please let me know
    Have fun with the code.
    P.s I don´t know how to upload the "PDF" document. I wrote you an email, please get back to me if you still need the file.

  • Email submit button causing required error when all required fields are filled in

    It looks like if I have more than 1 instance of subform  added,  my email submit button triggers "..at least one required " error message when all required fields are filled-in.
    I toggle subforms between "visible" and "hidden (from layout)".  Any suggestion is appreciated.
    ralph

    The fields that are hidden should have the validate.nullTest property set to "disabled", something like;
    TextField1.validate.nullTest="disabled";

  • Bug in forms- Won't submit because required field is empty but it is not...

    Hello,
    I have the same bug in both our corporate and French website.
    When someone fill in the form, it says that one of the required field is empty, even when it is not:
    I put the form in a test page at www2.smasolutions.it/test.html
    Please, help me as quickly as you can as the websites are live. We put the simple form for now as it is the only one that is working but we need to grab more info !
    Thanks
    Esther

    Esther,
    The field with the label 'Société*' is actually the email field, so it requires a valid email address.
    I suspect you changed the label name in Muse from 'Email' to 'Société*'. Change the name of the label back to 'Email' so it's clear to the user what they need to enter in the field...

  • At least one required field was empty on export. Please fill in the required fields (highlighted)

    "At least one required field was empty on export. Please fill in the required fields (highlighted)"
    I'm tearing my hair out with this one. Have checked all the fields to confirm if I had set the Type as User Entered - Required. Can't find any such field. Any help would be appreciated. Is there an email id where I can send the form?

    Hi,
    In your script when you make an object visible, you also make it mandatory. No problem there!
    However the script that hides the object goes through this sequence:
    hide the object, THEN
    make it optional/not mandatory.
    This is where the problem lies.
    You FIRST need to make the object optional/not mandatory AND THEN hide the object. It should just be a simple case of work through the various scripts and having the mandatory line before the presence line.
    There is an example here: http://assure.ly/hxHupW.
    Hope that helps,
    Niall

  • How To: Disable the Print button until Required Fields are filled out

    I have a PDF Form that I have created using LiveCycle Designer 8. On my PDF Form, I have a bunch of fields that are required. Is it possible to disable the Printer button until the user fills out all the required fields? We don't want a user being able to print out an incompleted form.

    It's not possible.
    However, you can create buttons on your document that "help" the user print
    just a part of the document: a certain page range, just the current page,
    etc.

  • Adobe forms-checking that required fields are completed-Java Script

    I have inserted two Java Scripts into my form--one for checking for required fields are completed, and then one for generating an email pulling a custom subject line, as shown below:
    var emptyFields = [];
    for (var i=0; i<this.numFields; i++) {
         var f= this.getField(this.getNthFieldName(i));
         if (f.type!="button" && f.required && f.display==display.visible) {
              if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);
    if (emptyFields.length>0) {
         app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));
    this.mailDoc({bUI:false,cTo:"[email protected],[email protected],[email protected]",cSubject:"Bugzilla Form for: "+this.getField("Bugzilla Title").value+" - "+this.getField("Bugzilla ID").value})
    Issue: After the error window displays fields that have not been completed, when I click OK the email window displays.
    QUESTION: How can I stop the email window from displaying until all fields are completed?
    THANKS!

    Thank you so much for your quick response (and thank you for all the code that I am reusing!) I have another issue now.Can you see why the following is occurring....
    I placed else in and now it edits the required fields, but once they are completed, will not initiate the email prompt. Here's what I have now
    var emptyFields = [];
    for (var i=0; i<this.numFields; i++) {
         var f= this.getField(this.getNthFieldName(i));
         if (f.type!="button" && f.required && f.display==display.visible) {
              if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);
    if (emptyFields.length>0) {
         app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));
    elsethis.mailDoc({bUI:false,cTo:"[email protected],[email protected],[email protected]",cSubject:"Bugzilla Form for: "+this.getField("Bugzilla Title").value+" - "+this.getField("Bugzilla ID").value})

  • "iTunes can not run because some of the required fields are missing.  Please reinstall iTunes."  What the ****?!

    "iTunes can not run because some of the required fields are missing.  Please reinstall iTunes."  What the ****?  Please help me figure this out.  I already removed quicktime (as another thread suggested).  I can't get in!

    i get same error.
    I have uninstalled and reinstalled more times than i care to count. but still i get
    itunes cannot run because some of its required files are missing.

  • Data in dropdown list field are empty in PDF form

    Hi all.
    Viewing a pdf form created with SAP interactive Forms offline method, the data in the dropdown list field are empty.
    The data in the dropdown list field are generated by xml file produced by an abap report.
    The problem occurs opening the form with Adobe Reader 8.1 or higher. Using Adobe Reader release 7.0.9 everything is ok.
    Do you have any suggestion?
    Thanks in advanced.
    Best Regards.
    Moreno

    Hi Otto,
    the only release of Adobe Reader that work is 7.0.9. Release 8.1 and 9 have the same problem where the data in the dropdown list field are empty.
    At the end of the trace file in Adobe Reader 9.0.3 I find this error message:
    "Invalid version: The current version of the XFA template model exceeds the capability of Acrobat / Adobe Reader 7.0.5."
    The form has been created using Adobe Lifecycle Design 7.1.
    Any idea?
    Thanks
    Moreno

  • Office 2010 Don't print blank lines when data fields are empty

    How do you do this in office 2010?  Where do we go now?
    This used to be under the Tools menu in previous versions:
    On the Tools menu, click Mail Merge.
    In the Mail Merge Helper dialog box, click Merge.
    NOTE: You must select the main document and data source for the merge before doing step 2.
    In the Merge dialog box, under When Merging Records, click either:
    Don't print blank lines when data fields are empty.
    -or-
    Print blank lines when data fields are empty.
    Click Close in the Merge dialog box, and then click
    Close in the Mail Merge Helper.
    NOTE: If you made no changes in the Merge dialog box, the
    Close button is not available. Click Cancel instead.
    Back to the top

    Hi,
    In Word 2007 or Word 2010, you can add
    Mail Merge Helper to the Quick Access bar, and perform the steps then.
    To add the
    Mail Merge Helper command in the Quick Access Toolbar in Word 2007, follow these steps:
    a.                 
    In Word 2007, click the
    Microsoft Office Button, and then click Word Options >
    Customize.
    In Word 2010, click File > Options > Customize Ribbon.
    b.                 
    Click
    All Commands in the Choose commands from, and then click
    Mail Merger Helper in the Choose commands from list.
    c.                  
    Click
    Add, and then OK.
    Best Regards,
    Sally Tang

  • Prevent submit if required field is empty

    HI.
    I have input text fields that has "Required" property set to true and indeed I can see "*" sign near the field.
    I also have a button on he page .
    How do I prevent the page from being submitted if required field is empty?

    Hi,
    1. point the disabled property of the command button to a managed bean (view scope) that has its default set to "true"
    2. set autoSubmit="true" to the input text component
    3. set a value change listener to point to a method in the same managed bean
    4. If the new value of the textfield is not null or empty, set the managed bean property that the disabled property points to to "false"
    5. Configure the command button Partial Trigger property to point to the ID of the input text field
    Frank

  • How to make a subform not print if the fields are empty

    I'm once again working on that kind of client form where our agents fill in a bunch of fields on our forms and I only want those fields that are pertinent to that client to print out and I've grouped the fields that go together into separate subforms.
    There are date fields and currency fields that relayout to floating fields in hidden blocks of text that appear when the last text field is exited, ie:
    Subform1  "On 5/14/12 your application was approved. We will pay $100 to your account"
    Subform2  "On 5/14/12 we received your application. We will need further information before you claim for $250 can be approved" etc. Obviously, both of these subforms cannot appear on the letter.
    Jono gave me a great solution for not printing checkboxes that are not checked with a preprint script which worked perfectly and I tried to adapt that to the subforms but alas my skills are lacking. I tried just putting it in each fill in field but then the blocks of text still remained.
    So basically I don't want the subforms that have empty fields to print.
    I'd appreciate any help that can be offered.

    Hi,
    I think that the logic/script should be placed in the area where the user either approves or rejects the claim. This would avoid a prePrint script to check if fields are empty or not.
    If you are stuck with checking if fields are empty on prePrint, then you would just need to check the relevant fields one at a time or use a loop.
    Hope that helps,
    Niall

  • DOCTYP and IDOCTP fields are empty

    Hello!
    I'm using XI with the scenario plan driven procurement. I'm able to bring my orders from MM to SUS, but the purchase order confirmations make some problems.
    In transaction SXMB_MONI (SUS) everything is fine, but in R/3 transaction BD87 brings an error: DOCTYP and IDOCTP fields are empty. Detailed info: An IDoc is to be generated whose control record does not have sufficient information in it. Neither the field IDOCTP nor the field DOCTYP has a value. Therefore, the IDoc cannot be stored properly.
    Where can I give the system the information about that?
    Hoping for help,
    Barbara

    Hi,
    Try to solve the problem like this ,
    First check the SWCV is properly configured or not and come back to IR , Refresh  the SLD Cache..
    Next try to activate SWCV-namespace, objects you created one by one..
    refer the below links for cache related issues
    /people/sravya.talanki2/blog/2005/12/02/sxicache--ripped-off - SXI_CACHE - Ripped Off
    XI Runtime cache error: Cache contents are obsolete
    Cache Refresh - SAI_CACHE_REFRESH
    /people/sravya.talanki2/blog/2005/11/03/cache-refresh-errors--new-phenomena
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1a69ea11-0d01-0010-fa80-b47a79301290
    Regards
    Chilla
    <i>reward points if it is useful..</i>

  • Filename in Save As dialog when saving PDF file

    I have a web site serving up PDF files. Without going into details, the URLs of the PDFs are not just your basic URL but look simething like this:
    http://www.domain.com/WorkFlowApp/Clients/demo1/secure/Promo%20Cover%20Cool-MedH i.pdf?userId=55b64ad5-28a2-490e-b3d6-4944099a390f#collab=CollabService@http://ww w.domain.com/ICCollab/IC_Service.asmx?WSDL
    In this case the actual filename is "Promo Cover Cool-MedHi.pdf"
    While viewing in Safari (OS X), if the user saves the PDF to their local machine, the Save As dialog comes up and the filename field is automatically populated. The problem is, instead of using just the filename, the field contains this:
    http---www.domain.com-WorkFlowApp-Clients-demo1-secure-Promo%20Cover%20Cool-MedH i.pdf?userId=55b64ad5-28a2-490e-b3d6-4944099a390f#collab=CollabService@http---ww w.domain.com-ICCollab-IC_Service.asmx?WSDL
    I know when performing the same action on Windows using Internet Explorer, the Save As dialog box filename field is populated correctly with just the filename (although it shows up URL encoded as Promo%20Cover%20Cool-MedHi.pdf, which is OK).
    I'd like to be able to force Safari to use just the filename in the Save As dialog box. Has anyone come accross this problem and figured out a solution?

    Hello Ebnul.nao
    I am having this same problemwith trying to work this out.
    Did you succeed in the end?
    I will really appreciate your help if you did
    Kind regards

  • Chinese characters copying incorrectly when saving pdfs with Preview

    So this is a very strange problem. When I save a .pdf that I have annotated in Preview, it saves fine and everything continues to display correctly. However, if I then try to copy Chinese characters from the pdf, it pastes gibberish. F'rex:
    灿烂辉煌 becomes "3456"
    and
    遇到的问题 becomes " !"
    Does anyone know what is going on and how to deal with it?

    The strange part is that initially the Chinese characters copy fine. It's only after I save the .pdf that copying goes all wonky.
    I think there is a bug related to annotation.
    Is there any way to control what encoding Preview uses when saving?
    No. PDF is the worst possible format to use for any kind of editing.
    Have you tried Adobe Reader? Or Skim?
    http://skim-app.sourceforge.net/
    Preview is not always the best option.

Maybe you are looking for