Skip to main content
Participating Frequently
August 11, 2020
Question

alert for required fields before proceeding to next page

  • August 11, 2020
  • 4 replies
  • 2661 views

Complete form newbie, so please redirect me, as this has to already be covered, but I've not found it yet...

I managed to get my head round the javascript for dependent dropdowns thanks to you guys, so I'm hoping you'll be able to get me sorted for this.

I would like the required fields on each page of my form to be checked (and highlighted somehow if possible) where they have been left empty or unselected (combinations of text fields, check boxes and radio buttons on most pages), when the user clicks the 'next' button to advance to the following page.

 

Also if anyone can tell me if it's possible to have a message pop up if the form user selects 'Withdraw document' or 'Superseded document' from the Type of Change dropdown that says something like "complete Superseded By field"???

 

I've attached the latest draft  - started adding fields to Page 2. Form originally created in PowerPoint and has some actions associated with buttons already from that source.

 

Greatful for any and all support or redirection provided.

Izzi

This topic has been closed for replies.

4 replies

Participating Frequently
August 12, 2020

Hi thank you both for your insights and suggstions.

The form isn't submitted to a single person, but to whomever is the appropriate Document Authority for the document being created, updated or withdrawn, once the Document Owner has reached either page 6 or page 7 (depending on the type of document they wish to have published).

I see I can collect form data as attachments to email, using mailto: followed by the email address. Is there some coding you're aware of that allows the document to be attached to a blank e-mail?

Another issue I've encountered whilst trying the options suggested is that as the form is 90% filled before submitting for approval, it would always have one final required field for the Document Authority to complete and that's the sign-off (which I've set to use the built-in e-signature option).

Any suggestions how I get the submit form to ignore that one final required field, or am I expecting too much?

Perhaps I need a different route?

Going through these steps has highlighted that I'd missed the first 'submit' (e-mail form to approver) off. I'll upload a new version of the form when I've done that. I need to get on the road now.

I look forward to seeing if you have any gems for me as soon as I can get back online. Thank you x

Thom Parker
Community Expert
Community Expert
August 12, 2020

Here's an article that explains the email options for scripting.

https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address/

 

An unfilled required field will always block a form submit. So either don't use a submit (which ignores all required fields) or turn off the required property.  

 

What you are saying is that there are different required fields for different form fillers. 

One way to handle this situation is to have a different submit button for each user. Then use a script on the button to set the required properties on the appropiate fields before the submit. 

Another option is to make this an Adobe Sign form. Adobe Sign handles different requirements for different users.  

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
August 19, 2020

Hi Thom - thanks for sharing your article. I'm a complete newbie at all things Javascript and I just can't follow it. I've had another coffee and tried again; still not any clearer as to whether I can get a solution that will work for my form.

 

Re: "One way to handle this situation is to have a different submit button for each user."

User 1 fills out all fields up to either page 6 or page 7 (as described earlier). They then need to submit the partially completed for to an Approver, who completes the last part of the form whereby they confirm that they are satisified with User 1's entries on the form and that Approver then e-mails the form to one of two possible e-mail addresses.

 

Could you possibly tell me if one of the options in your article is appropriate for this and which one that is and perhaps give me a bit more steer on where in the form I need to create the wonderful Javascript magic?

 

Thanks in advance,

Izzi

try67
Community Expert
Community Expert
August 12, 2020

I don't recommend you do that. It can be very annoying for the users. It's enough that you've set the fields as required. That means the users won't be able to submit the form back to you until they are filled in, but you have to use a Submit Form command for that, not just a mailto link.

Participating Frequently
August 19, 2020

Hi try67,

I need the person who completes the first 6-7 pages (user 1) to submit the form for approval and then I need the approver (user 2) to submit the form to one of two e-mail addresses (if document is of type X, send to #1, if  document is of type Y, send to #2).

I can't see how to attach the latest version of the form so you can see better what I'm meaning (the form has been revised since I originally attached it).

If I have required fields that need must be completed for User 1 to submit the form for approval but not the fields that User 2 must complete, is there a script to tell Acrobat to only pay attention to required fields in pages 1-7 and ignore any required fields that the User 2 completes on say page 8?

Thanks for your assistance,

Izzi

Thom Parker
Community Expert
Community Expert
August 11, 2020

Yes, I think all the things you've mentioned are possible through scripting.  

Here's an article on using the Alert Box

https://acrobatusers.com/tutorials/popup_windows_part1/

 

"required" is a property of the field object. So just add a script to your Next button that searchs for fields that have both the "required" property set to true and are on the page in question.   

One way to do this might be to prefix all the field names on each page with "PageX." This will group all the fields on that page for easier access. But only do this if the group naming won't interfere with other features on the form. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
August 11, 2020

If you'd like to see the PowerPoint file, I can upload that too. Let me know. Tks