Expand my Community achievements bar.

SOLVED

Help with a script for date field

Avatar

Level 7

Is it possible when the display of a date field is not as: date{EEEE, MMMM D, YYYY}

then

Message: "Please select a date from the date calendar"

and focus on the date field

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

I was thinking of the exit event, if you change the this.rawValue to xfa.event.change you could try using the calculate event ... which would mean they get the message sooner.

Either way they will still be able to cut-and-paste a date if it is in the correct format.

Bruce

View solution in original post

3 Replies

Avatar

Level 10

Hi,

You can try something like;

if (!this.isNull)

{

    var date = util.scand("yyyy-mm-dd", this.rawValue);

    if (date == null || this.formattedValue != util.printd('EEEE, MMMM D, YYYY', date, true))

    {  

        app.alert("Please select a date from the date calendar");

        xfa.host.setFocus(this);

    }

}

Regards Bruce

Avatar

Level 7

Bruce, Thank you again for all your help!

Do I have to use EXIT Event?

Thanks

Avatar

Correct answer by
Level 10

I was thinking of the exit event, if you change the this.rawValue to xfa.event.change you could try using the calculate event ... which would mean they get the message sooner.

Either way they will still be able to cut-and-paste a date if it is in the correct format.

Bruce