Help with a script for date field

mmgiath

16-12-2015

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

Accepted Solutions (1)

Accepted Solutions (1)

_Bruce_Robertson

MVP

17-12-2015

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

Answers (2)

Answers (2)

_Bruce_Robertson

MVP

16-12-2015

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