day of the week?


is there way check if entered date day of week?

 

i alert user if date entered, have format "m/d/yy" on format properties, date entered not sunday date. tried use util.scand function unable figure out how script value sunday.

 

i tried put following in validation script:

 

 

var efdt = event.value;
var day = util.scand("dddd", efdt);

 

if(day.value!="sunday")

{app.alert("most changes should effective on sunday, please check entered date correct date change should take place.")}

console.println(day.value)

 

the time alert when reset form...

in debugger get:

 

day null
4:field:validateexception in line 4 of function top_level, script field:validate

 

typeerror: day null
4:field:validate

 

i sure means if criteria not correct syntax, have run dead end when trying search more help.

thanks in advance can provide...

the custom validate script data field like:

 

(function () {

 

    // nothing if field blank

    if (!event.value) return;

 

    // entered date, date object

    var ed = util.scand("m/d/yy", event.value);

 

    // if date not sunday...

    if (ed.getday() !== 0) {

 

        // alert user

        app.alert("your message goes here.", 3);

 

        // optionally, reject entry

        event.rc = false;

    }

 

})();

 

 

edit: corrected code



More discussions in PDF Forms


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support