But,
that or the one you suggest is really not the issue. This is focus issue. Once the user corrects the invalid e-mail message with a valid email address, the regex check is performed upon losing focus on that email textbox. If the address is still incorrect
he puts focus back on the email text box and reissues the error message. If the email address is correct, he takes no action that I can find to trap. So, the user just sees the system sit there. If they click the create user button again, then all is well.
But, I've instructed the users that this could take a minute or so to register them - so, mostly, the user just sits there thinking this is a crappy system. The problem is that I can't seem to trap the simple fact that the user clicked that create user button.
If I could, then perhaps the page valid check would work and I could fire the actual create user process.
I've
gotten pretty frustrated with this and just decided to use a funky work-around by having the user click a "check email" label I put next to the email text box if they get an error message. The label does nothing but move the focus so that regex can do its
thing. If the error message goes away then the user is directed to click the create user button. Not very elegant but better than a poke in the eye with a stick.
Are there any other textbox "create user" fields on the form? If password fields are on the same form as the email form (where validation occurs) the user must re-enter their password(s).
There is nothing on this page except the result of the create user wizard and that "check email" which is my temporary workaround (and way to test what is happening). Everything in the green area at the top is from a master page.
I'm thinking I should try using Ajax or Jquery to get at the user click of the "create user" button. I'm hoping I can test for page valid and, if valid, call the create user process. And get rid of that dumb Check E-mail label. What do you think?
I'm out of ideas as well ... without seeing all your code (.aspx and code behind) I can't suggest much. If you care to supply access to your code let me know. I can try a few tests on my end.
It works as long as I leave the "alert" in place. If I take it out it ignores a bad email and creates the user. Also, that .trigger('focus') doesn't seem to work.
What I need is for some way to stop the registration process (create user) from going forward when I can see that the email is bad.
Imar Spaanjaars, WROX author of Beginning ASP.NET 4 in C# and VB, over on the WROX P2P board, came up with the best fix for this wizard bug (it is an MS bug). Here is the code for a simple test of the problem and a work-around:
The key to this work-around is the "onmouseover" bit of code. It forces the validation before the user
actually clicks the create user button. So, the validation occurs AND the create user process is fired.
daveharney
Member
91 Points
43 Posts
Re: create user wizard email validation
Apr 06, 2012 02:19 AM|LINK
Hi olivespike, thanks for the reply.
I have
ContinueDestinationPageUrl="~/Default.aspx"
But, that or the one you suggest is really not the issue. This is focus issue. Once the user corrects the invalid e-mail message with a valid email address, the regex check is performed upon losing focus on that email textbox. If the address is still incorrect he puts focus back on the email text box and reissues the error message. If the email address is correct, he takes no action that I can find to trap. So, the user just sees the system sit there. If they click the create user button again, then all is well. But, I've instructed the users that this could take a minute or so to register them - so, mostly, the user just sits there thinking this is a crappy system. The problem is that I can't seem to trap the simple fact that the user clicked that create user button. If I could, then perhaps the page valid check would work and I could fire the actual create user process.
I've gotten pretty frustrated with this and just decided to use a funky work-around by having the user click a "check email" label I put next to the email text box if they get an error message. The label does nothing but move the focus so that regex can do its thing. If the error message goes away then the user is directed to click the create user button. Not very elegant but better than a poke in the eye with a stick.
olivespike
Member
176 Points
63 Posts
Re: create user wizard email validation
Apr 08, 2012 01:10 AM|LINK
Are there any other textbox "create user" fields on the form? If password fields are on the same form as the email form (where validation occurs) the user must re-enter their password(s).
daveharney
Member
91 Points
43 Posts
Re: create user wizard email validation
Apr 09, 2012 01:45 AM|LINK
Hi olivespike,
There is nothing on this page except the result of the create user wizard and that "check email" which is my temporary workaround (and way to test what is happening). Everything in the green area at the top is from a master page.
I'm thinking I should try using Ajax or Jquery to get at the user click of the "create user" button. I'm hoping I can test for page valid and, if valid, call the create user process. And get rid of that dumb Check E-mail label. What do you think?
olivespike
Member
176 Points
63 Posts
Re: create user wizard email validation
Apr 09, 2012 10:57 PM|LINK
I'm out of ideas as well ... without seeing all your code (.aspx and code behind) I can't suggest much. If you care to supply access to your code let me know. I can try a few tests on my end.
daveharney
Member
91 Points
43 Posts
Re: create user wizard email validation
Apr 11, 2012 04:16 AM|LINK
Hi olivespike,
Here is what I tried (and I removed the email validation from the wizard):
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/jscript" src="../scripts/jquery-1.7.2.min.js">
</script>
<script type="text/jscript">
$(function ()
{
$("#ContentPlaceHolder1_CreateUserWizard1_CreateUserStepContainer_Email").bind('change', function (event)
{
if (/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test($(this).val()))
{
$("#ContentPlaceHolder1_CreateUserWizard1___CustomNav0_StepNextButton").trigger('click')
}
else
{
alert("Please use a valid email")
$("#ContentPlaceHolder1_EmailErrMsg").text("Please enter a valid email address")
$("#ContentPlaceHolder1_CreateUserWizard1_CreateUserStepContainer_Email").trigger('focus')
};
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" >
<ErrorMessageStyle BackColor="#FFFFCC" BorderColor="Black"
BorderStyle="Solid" />
<ValidatorTextStyle BackColor="#FFFFCC" />
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
<CustomNavigationTemplate>
<table border="0" cellspacing="5" style="width:100%;height:100%;">
<tr align="right">
<td align="right" colspan="0">
<asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext"
Text="Create User" ValidationGroup="CreateUserWizard1"/>
</td>
</tr>
</table>
</CustomNavigationTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
<asp:Label ID="EmailErrMsg" runat="server" Text=" " ForeColor="Red"></asp:Label>
</asp:Content>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
It works as long as I leave the "alert" in place. If I take it out it ignores a bad email and creates the user. Also, that .trigger('focus') doesn't seem to work.
What I need is for some way to stop the registration process (create user) from going forward when I can see that the email is bad.
olivespike
Member
176 Points
63 Posts
Re: create user wizard email validation
Apr 11, 2012 09:49 PM|LINK
I'll need any code behind (C#) associated....
olivespike
Member
176 Points
63 Posts
Re: create user wizard email validation
Apr 12, 2012 12:41 AM|LINK
Oppps ... I see you're validating via jscript. Let me take another look....
daveharney
Member
91 Points
43 Posts
Re: create user wizard email validation
Apr 22, 2012 10:08 PM|LINK
Hi olivespike,
Imar Spaanjaars, WROX author of Beginning ASP.NET 4 in C# and VB, over on the WROX P2P board, came up with the best fix for this wizard bug (it is an MS bug). Here is the code for a simple test of the problem and a work-around:
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPages/1Column.master" AutoEventWireup="false"
CodeFile="SignUpTest2.aspx.vb" Inherits="SignUpTest2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:CreateUserWizard ID="CreateUserWizard3" runat="server" ContinueDestinationPageUrl="~/Default.aspx"
EmailRegularExpression='\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*'>
<MailDefinition BodyFileName="~/App_Data/SignUpConfirmation.txt" Subject="Your new account at Ozaukee Bike Routes">
</MailDefinition>
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep3" runat="server">
<CustomNavigationTemplate>
<table border="0" cellspacing="5" style="width:100%;height:100%;">
<tr align="right">
<td align="right" colspan="0">
<asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext"
Text="Create User" onmouseover="document.getElementById('ContentPlaceHolder1_CreateUserWizard3_CreateUserStepContainer_Email').blur();"
ValidationGroup="CreateUserWizard3" />
</td>
</tr>
</table>
</CustomNavigationTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep3" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
</asp:Content>
The key to this work-around is the "onmouseover" bit of code. It forces the validation before the user actually clicks the create user button. So, the validation occurs AND the create user process is fired.