Skip to main content
ShaneSpace
Participant
March 17, 2022
Question

Field that accepts formatted date and text

  • March 17, 2022
  • 2 replies
  • 550 views

Hello all,

 

I have a reference check form that I am creating in Acrobat Pro DC. For the dates of employment, I need for the End Date field, which is formatted as mmmm-yyyy, to also accept "Present" if the applicant is still employed. Is there a way to achieve this?

 

Thanks in advance!

This topic has been closed for replies.

2 replies

JR Boulay
Community Expert
Community Expert
March 18, 2022

About date formats.

🙂

 

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
March 18, 2022

There's always an XKCD...

try67
Community Expert
Community Expert
March 17, 2022

Try this code as the custom validation script of the field:

 

if (event.value) {
	if (util.scand("mmmm-yyyy", event.value)==null && event.value!="Present") {
		app.alert("Invalid value entered.");
		event.rc = false;
	}
}

 

You must set the Format option to None, though.

ShaneSpace
Participant
March 17, 2022

Thanks for the reply. However, I need for any type of date format entered to be converted to the mmmm-yyyy format as well as allowing something other than “Present” to be added as text. For example, a user may enter “Current”, not knowing that the field is restricted to a specific word.

 

Could this be done via a dropdown box where the user can select either “Present” or to enter a date that will be formatted correctly?

 

Thanks again!

 

try67
Community Expert
Community Expert
March 17, 2022

You can't allow any type of date format because they can be conflicting.

For example, if your user enters "01/02/2022" you can't know if it's January 2nd or February 1st, unless you make some assumptions as to what format they're using.

 

And you can adjust the error message saying they can only enter the date in a specific format or enter "Present". You can also use a tooltip, or static text on the page next to the field... There are many ways to inform the user of these restrictions.