Menu

#7 regexps in js

open
None
5
2005-09-24
2005-09-08
JT Moree
No

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.

Discussion

  • JT Moree

    JT Moree - 2005-09-08

    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.

     
  • James A. Pattie

    James A. Pattie - 2005-09-24
    • assigned_to: nobody --> pcxuser
     
  • James A. Pattie

    James A. Pattie - 2005-09-24

    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.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.