Help with a script for date field

Avatar

Avatar

mmgiath

Avatar

mmgiath

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)

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_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)

Avatar

Avatar

mmgiath

Avatar

mmgiath

mmgiath

17-12-2015

Bruce, Thank you again for all your help!

Do I have to use EXIT Event?

Thanks

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_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