Skip to main content
January 5, 2017
Question

Coding Less Than Sign

  • January 5, 2017
  • 2 replies
  • 912 views

Can you code a less than sign. If a date is entered before 1/1/2017, I would like to create an alert.  This is the script I came up with but it's not working and I can't find anything out there on the internet for it.

if(event.value > "01/01/2017"){

app.alert("Please confirm the date entered",1);

Thanks.

This topic has been closed for replies.

2 replies

JR Boulay
Community Expert
Community Expert
January 5, 2017
Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
January 5, 2017

You can only use these operators on numbers, not on strings.

To compare dates is a more complex process. You need to first convert the strings to a Date object (using util.scand), and then you'll be able to access their getTime method, which returns a number of milliseconds for that date, which you can then compare with another date.

January 6, 2017

I am very confused with this as I have not encountered what you are suggesting. Do you have a link I could read through in order to figure this out?  Is this something I do in the document level or within the Field properties?

Thanks.

try67
Community Expert
Community Expert
January 6, 2017

Let's take a step back. What are you trying to achieve, exactly?