Similar to my problem with converting a big chunk of validation into smaller chunks of functions I am trying to use Regular Expressions to handle the validation of many, many time fields.
I have a set of FormCalc scripts to calculate the various values for days, hours and the gain/loss of hours over a four week period. For these scripts to work the time format must be in HH:MM.
Accessibility guidelines nix any use of message box pop ups so I wanted to get around this by having a hidden/visible field with warning text but can't get it to work.
So far I have:
var r = new RegExp(); // Create a new Regular Expression Object
r.compile ("^[00-99]:\\] + [00-59]");
var result = r.test(this.rawValue);
if (result == true){
true;
form1.flow.page.parent.part2.part2body.errorMessage.presence = "visible";
}
else (result == false){
false;
form1.flow.page.parent.part2.part2body.errorMessage.presence = "hidden";
}
trying with
r.compile(/^00-99]:\\] + [00-59]$/);
Then, u can write it shorter:
obj.presence = r.test(this.rawValue) ? "visible" : "hidden";
Hope, it will help you someway!?
Djinges