Locked

validate

Community Beginner ,
Feb 25, 2019 Feb 25, 2019

Copy link to clipboard

Copied

Date Issue 001.jpgI am attaching an image of a portion of a log page. As you see, there are multiple (six) identical records - each has a date field.

I need to do two things: 1) Assure that the date being entered does not predate the date field in the previous record, and 2)

verify that there is indeed a date in the date field of the previous record (avoid skipping records). Here is some code I have tried, but I cannot get the if condition to work:

Please share your thoughts.

//THIS VALIDATES THE DATE ENTERED

var cMsg = "The date you entered is invalid.\n\nPlease enter a date that does not pre-date the previous entry date.";

var nIcon = 0;

var nType = 0;

var cTitle = "DATE ERROR";

var str = event.target.name;

var res = str.charAt(str.length-1);

var d1 = Date.parse(this.getField("0." + (res-1)).value);

var d2 = Date.parse(event.value);

if (d1 == 0) {

if (d1 > d2) {

app.beep();

app.alert(cMsg, nIcon, nType, cTitle);

event.value = "";

}

} else {

var cMsg = "This is an invalid entry\n\nThe previous date entry cannot be empty.\n\nPlease use the entry above first.";

app.beep();

app.alert(cMsg, nIcon, nType, cTitle);

}

TOPICS
Acrobat SDK and JavaScript, Windows

Views

91

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Most Valuable Participant , Feb 25, 2019 Feb 25, 2019

Likes

Translate

Translate
Most Valuable Participant ,
Feb 25, 2019 Feb 25, 2019

Copy link to clipboard

Copied

LATEST

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines