The form object needs a feature which would take any
constraints defined in the profile and output them in javascript
on the client side. When the page is submitted if the
programmer wishes he can call a predefined methods such as
if (constraintCheck(this.form)) { this.form.submit(); }
The routine would run this algor.
function constraintCheck(formObj)
{
for (var i in CONSTRAINTS)
{
var value;
eval("value = formObj."+i+".value;");
if ( CONSTRAINTS[i].exec(value) == null)
{
alert("Invalid: " + i);
return false;
}
}
}
potential problems:
P) if there is a constraint defined for a
special field that is not on the client side but is generated
during populate.
S) Programmer cannot use the automatic js constraints with
special fields.
Logged In: YES
user_id=236631
sometimes it seems like a perl regexp that works fine doesnt work
in js. we might need a workaround or again the programmer just
doesnt get to use this feature until we do.
Logged In: YES
user_id=27290
The algorithm also needs to take into account the type of
formObj, since not every form item has a .value field, and
we need to make sure we are only trying to do constraints
actually defined for the formObj in question.