Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Help with a script for date field

mmgiath
Level 7
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
_Bruce_Robertson
Correct answer by
Level 10
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
_Bruce_Robertson
Level 10
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

mmgiath
Level 7
Level 7

Bruce, Thank you again for all your help!

Do I have to use EXIT Event?

Thanks

_Bruce_Robertson
Correct answer by
Level 10
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