Skip to main content
Known Participant
February 9, 2016
Answered

Force User to Complete a Field

  • February 9, 2016
  • 1 reply
  • 1514 views

I’m working in Acrobat Pro DC.

I have a dropdown (DepartAnswer) that contains the choices Yes or No. If the user chooses No, they go on to the next field. If they choose Yes 2 text fields appear; one that is Read Only, with default text of: - keep till:  The second field (AvailDate) is empty for the user to put a date.

What has been requested of me is to have the AvailDate field be a mandatory field, if the user has chosen Yes, then there must be a date in the AvailDate field. This form is e-mailed via a button and they do not want the form e-mailed without that field (AvailDate) completed – not tabbed over and left empty.

Is it possible to force the user to complete this field before moving on?

This topic has been closed for replies.
Correct answer try67

So the way that I have the button set up is the mailDoc method?

If I use the submitForm I don't have the ability to place field values in the subject line as I do with JavaScript...correct?

What would be the script to get the user to enter information into AvailDate?


- Yes, you're using mailDoc.

- No, that's not correct. You can use this code to do it:

//cToAddr is the e-mail address you are sending to

var cToAddr = ""

//cSubLine is the Subject line with the name of the employee the 24-2812 pertains to

var cSubLine = "24-2812 - " + this.getField("DD1").value + " for " + this.getField("Text2").value + ", " + this.getField("Dropdown6.0").value;

//this produces the e-mail

this.submitForm({cURL: "mailto:" + cToAddr + "?subject=" + cSubLine, cSubmitAs: "PDF"});

- Using the code above they will not be able to submit the file unless they filled in all required fields first.

1 reply

Inspiring
February 9, 2016

You can mark the field as Required and the submit form action won't be allowed to take place unless it it filled-in.

Another approach is to use JavaScript, where you have the opportunity to check fields more completely and give more helpful feedback to the user. The script would first check the required fields and only proceed with the submitForm statement if everything checks out.

Angus24Author
Known Participant
February 9, 2016

Ok, this may sound silly, but I have done that.  On the AvailDate field I have checked Required under the General tab, the outline of the field turns red. But I am still able to click on the button to e-mail the form and it does so with AvailDate empty.

Am I doing something wrong?

Karl Heinz  Kremer
Community Expert
Community Expert
February 9, 2016

How are you emailing the document? There are different methods, and the "required" fields will only be checked when you are doing a true forms submission. If you are using the Doc.mailDoc() method for example to email your document, that is not a forms submission, and it will therefore not check the required fields.