hi,
as I think date can be validated by js as well as by spel.
js variant:
add event to your date field, I prefer to use event listener.
function attEvt(eventName, target, handlerName){
if (target.addEventListener) {
target.addEventListener(eventName, handlerName, false);
} else if (target.attachEvent) {
target.attachEvent("on" + eventName, handlerName);
} else {
target["on" + eventName] = handlerName;
}
}
usage:
function z_validate(evt){
if(string_to_date('', evt.target.value, '') < Math.round(Date.now() / 1000)){
alert("ERROR!");
evt.target.value = "";
}
}
attEvt("blur", ahdframe.document.getElementsByName('SET.time_stamp')[0], z_validate);
spel variant:
mod file:
MODIFY cr POST_VALIDATE z_check_date(z_my_date) 1337; // REPLACE z_my_date WITH YOUR DATE ATTR
spl file:
cr::z_check_date(...)
{
date znow, z_my_new_date;
znow = now();
z_my_new_date = argv[3];
if((int)znow > (int)z_my_new_date ){
logf(ERROR, "Your stdlog error here [%s]", ref_num);
set_error(1);
set_return_data(format("Your html error here [%s]", ref_num));
return;
}
}