May 30, 2009, 10:41 AM
setting the RegEx property dynamicly!?!
Hi,
I am trying to validate a sign up form that has 2 fields one for the password and the other one is to retype the password.
for sure i can set a listner or ajaxevent for each textfields to check if they are in match or not and disable or enable the form submition, thats a way.
but i am thiking in making regex dynamic
so i tried the following:
but that didn't work. and i got an error that i captured through firebug, and it getting fired after i type any value in the password2 text field, which means the regex is getting a dynamic value but it doesn't accept the test function. maybe setting its value dyamicly, is defining it as string variable and its no longer recognized as regex. !!
"this.regex.test is not a function
validateValue()("password123")coolite.axd?30406 (line 1872)
processValue()()coolite.axd?30406 (line 1830)
cancel()()coolite.axd?30406 (line 477)
[Break on this error] if(this.regex&&!this.regex.test(value)){.. .rkInvalid(this.regexText);return false;}"
any Idea?
I am trying to validate a sign up form that has 2 fields one for the password and the other one is to retype the password.
for sure i can set a listner or ajaxevent for each textfields to check if they are in match or not and disable or enable the form submition, thats a way.
but i am thiking in making regex dynamic
so i tried the following:
<ext:Anchor Horizontal="100%">
<ext:TextField AllowBlank="false" BlankText="Password is required" ID="txtpassword1" runat="server" FieldLabel="Password">
<AjaxEvent>
<Change OnEvent="UpdateRetypeRegex"></Change>
</AjaxEvent>
</ext:TextField>
</ext:Anchor>
<ext:Anchor Horizontal="100%">
<ext:TextField AllowBlank="false" BlankText="retype password is required" ID="txtpassword2" runat="server" FieldLabel="retype">
</ext:TextField>
</ext:Anchor>
and at the server side i haveprotected void UpdateRetypeRegex(object sender, AjaxEventArgs e)
{
txtpassword2.regex = txtpassword1.text;
}
trying by that to set the regex value of the password2 textfield to be the exact value of the password1 textfield which make it validate its value based on this regex. but that didn't work. and i got an error that i captured through firebug, and it getting fired after i type any value in the password2 text field, which means the regex is getting a dynamic value but it doesn't accept the test function. maybe setting its value dyamicly, is defining it as string variable and its no longer recognized as regex. !!
"this.regex.test is not a function
validateValue()("password123")coolite.axd?30406 (line 1872)
processValue()()coolite.axd?30406 (line 1830)
cancel()()coolite.axd?30406 (line 477)
[Break on this error] if(this.regex&&!this.regex.test(value)){.. .rkInvalid(this.regexText);return false;}"
any Idea?