logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by Keith on Thu 22 Jun 2006 in response to Form Validator R3.0

Question

Hi Jake, thanks for cool validator! I'm having a bit of a problem implementing
it though. I have a web form which populates a field (RegExp_id) with a regular
expression (/(\D{3}\d{4})$/). I'm attempting to use that regular expression to
validate another field (ID) but to no avail. If I do an alert, it's getting the
value of the RegExp_id field. I've tried the following:


var RegEx = new RegExp(document.forms[0].RegExp_id.value,'g');
Validator.fields=
[
{name: "ID",type: "regex",pattern: RegEx, message: "Please enter a valid AD ID
(abc1234)"}
]


return Validator.validate();


Now, if I don't use the variable RegEx and just type in the regular expression
everything works as designed. I just can't get past this. Please help.


Thanks,
Keith