CreateUserWizard validation doesn't work

V

VB Programmer

I have several required field validators on each step of my
CreateUserWizard.

When I click Next it goes to the next step, even though the user hasn't
typed anything in.

I placed each "page" of validators in their own validation group.

Any ideas why this isn't working?

Thanks!
 
E

einarq

Maybe you could post the source code?
If you are hiding and showing panles, I don't you need to put the
validation controls in seperate groups, only the visible controls will
be validated.

Einar
 
V

VB Programmer

Here it is... Thanks...

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
BackColor="#F7F6F3" BorderColor="#E6E2D8"
BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"
Font-Size="0.8em" CancelDestinationPageUrl="Default.aspx"
CompleteSuccessText="Your account has been successfully created. We will
contact you shortly." ContinueDestinationPageUrl="~/ThankYouSubmitApp.aspx"
Width="518px" DisplayCancelButton="True" DisplaySideBar="True"
FinishDestinationPageUrl="~/ThankYouSubmitApp.aspx" ActiveStepIndex="4">
<WizardSteps>
<asp:WizardStep runat="server" Title="Racer Confirm">
<span style="font-size: small; color: red">
<table style="font-size: x-small; width: 420px; height:
152px;">
<tr>
<td style="width: 33px; height: 151px;">
</td>
<td style="HEIGHT: 151px">
<span style="font-size: 12pt; color:
#ff0000"><strong><span style="font-size: 10pt">
Please read before
continuing...</span></strong><br />
<br />
</span>
This application is for <span style="text-decoration:
underline">experience racers only</span>.&nbsp;
<br />
<br />
All non-racer memberships
will be automatically rejected.&nbsp; If you are a non-racer
and are interested
in a membership please click on the button below.<br />
<br />
<asp:Button ID="cmdMembership" runat="server" Text="I want
to become a MEMBER, NOT a racer." Width="291px" />
<br />
<span style="color: blue"></span>
<br />
Otherwise click Next to continue...</td>
</tr>
</table>
</span></asp:WizardStep>
<asp:WizardStep runat="server" Title="Contact Info">
<table border="0" style="width: 322px">
<tr>
<td align="right" colspan="1" style="width: 22px;
height: 13px; text-align: center">
</td>
<td align="right" colspan="2" style="height: 13px;
text-align: center">
<strong>
Contact Information<br />
BOLD - Required Field.<br />
<br />
<span style="color: red">For security
reasons, no single quotes, double quotes, or special
characters accepted (astericks,
etc...)</span></strong></td>
</tr>
<tr>
<td align="right" style="width: 22px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
188px;">
<strong>First Name:</strong></td>
<td style="height: 22px">
<asp:TextBox ID="txtFirstName"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFirstName"
ErrorMessage="Password is required."
ToolTip="Field is required." ValidationGroup="CreateUserWizard1"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr style="color: #000000">
<td align="right" style="width: 22px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
188px;">
<strong>
Last Name:</strong></td>
<td style="height: 22px">
<asp:TextBox ID="txtLastName"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtLastName"
ErrorMessage="Password is required."
ToolTip="Field is required." ValidationGroup="CreateUserWizard1"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr style="color: #000000">
<td align="right" style="width: 22px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
188px;">
Phone Number:</td>
<td style="height: 22px">
<asp:TextBox ID="txtPhone"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" style="width: 22px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
188px;">
Address:</td>
<td style="height: 22px">
<asp:TextBox ID="txtAddress"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" style="width: 22px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
188px;">
City:</td>
<td style="height: 22px">
<asp:TextBox ID="txtCity"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" style="width: 22px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
188px;">
State:</td>
<td style="height: 22px">
<asp:TextBox ID="txtState"
runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="right" style="width: 22px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
188px;">
Zip Code:</td>
<td style="height: 22px">
<asp:TextBox ID="txtZip"
runat="server"></asp:TextBox>
</td>
</tr>
</table>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Racing Exp">
<strong><span style="color: red"></span></strong>
<table border="0">
<tr>
<td align="right" style="width: 16px; height: 17px">
</td>
<td align="right" colspan="3" style="height: 17px;
text-align: center">
<strong>Racing Experience<br />
BOLD - Required Field.<br />
<br />
</strong><span style="color: red"><strong>For
security reasons, no single quotes, double quotes,
<br />
or special
characters accepted (astericks,
etc...)</strong></span></td>
</tr>
<tr>
<td align="right" style="width: 16px; height: 76px">
</td>
<td align="right" style="height: 76px; width:
88px;">
<strong>Points Series /<br />
$$$ Race Results:<br />
</strong>
<div style="text-align: left">
</div>
</td>
<td style="height: 76px; width: 39px;">
<asp:TextBox ID="txtExpYrs" runat="server"
Width="154px"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtExpYrs"
ErrorMessage="Password is required."
ToolTip="Field is required." ValidationGroup="CreateUserWizard2"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
<br />
<asp:Button ID="cmdAddExpYrs" runat="server"
Text="Add" />
<br />
<asp:ListBox ID="lstExpYrs" runat="server"
Width="159px"></asp:ListBox>
<br />
<asp:Button ID="cmdDelExpYrs" runat="server"
Text="Delete" />
</td>
<td style="width: 108px; color: blue; height: 22px;
font-size: xx-small;">
<span style="color: #0000ff"></span><span
style="font-size: xx-small"><strong><span style="text-decoration:
underline">
REQUIRED FIELD</span></strong><br />
Type in the entry then click Add. To Delete an
entry click on the item in the list
then click Delete.
<br />
<br />
2 examples below:<br />
</span>
<strong><em><span style="font-size:
xx-small">2004 NSCA D/R #2<br />
2006 US STREET NATIONALS O/L
#5</span></em></strong></td>
</tr>
<tr>
<td align="right" style="width: 16px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
88px;">
Sponsor:</td>
<td style="height: 22px; width: 39px;">
<asp:TextBox ID="txtExpSponsor" runat="server"
Width="148px"></asp:TextBox>
<br />
Url:
<asp:TextBox ID="txtExpSponsorUrl"
runat="server" Width="122px"></asp:TextBox>
<br />
<asp:Button ID="cmdAddExpSponsor" runat="server"
Text="Add" />
<br />
<asp:ListBox ID="lstExpSponsor" runat="server"
Width="159px"></asp:ListBox>
<br />
<asp:Button ID="cmdDelExpSponsor" runat="server"
Text="Delete" />
</td>
<td style="width: 108px; color: blue; height: 22px;
font-size: xx-small;">
</td>
</tr>
<tr>
<td align="right" style="width: 16px; height: 73px">
</td>
<td align="right" style="height: 73px; width:
88px;">
<strong>Class:</strong></td>
<td style="height: 73px; width: 39px;">
<asp:TextBox ID="txtExpClass"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtExpClass"
ErrorMessage="Password is required."
ToolTip="Field is required." ValidationGroup="CreateUserWizard2"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
<br />
<asp:Button ID="cmdAddExpClass" runat="server"
Text="Add" />
<br />
<asp:ListBox ID="lstExpClass" runat="server"
Width="159px"></asp:ListBox>
<br />
<asp:Button ID="cmdDelExpClass" runat="server"
Text="Delete" />
</td>
<td style="width: 108px; color: blue; height: 22px;
font-size: xx-small;">
<strong><span style="text-decoration:
underline">REQUIRED FIELD</span></strong><br />
4 examples below:<div>
<strong><em>drag radial = DR
(this is called class
designation)</em></strong></div>
<div>
<span class="Apple-tab-span"
style="white-space: pre"></span><strong><em>outlaw 10.5 =
O/L</em></strong></div>
<div>
<span class="Apple-tab-span"
style="white-space: pre"></span><strong><em>limited street
= LS</em></strong></div>
</td>
</tr>
<tr>
<td align="right" style="width: 16px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
88px;">
Website Url:</td>
<td style="height: 22px; width: 39px;">
<asp:TextBox ID="txtExpWebsiteUrl"
runat="server"></asp:TextBox>
</td>
<td style="width: 108px; color: blue; height: 22px;
font-size: xx-small;">
</td>
</tr>
<tr>
<td align="right" style="width: 16px; height: 22px">
</td>
<td align="right" style="height: 22px; width:
88px;">
Brief Comments:<br />
(250 char max)</td>
<td style="height: 22px; width: 39px;">
<asp:TextBox ID="txtExpComments" runat="server"
TextMode="MultiLine" Width="152px"></asp:TextBox>
</td>
<td style="width: 108px; color: blue; height: 22px;
font-size: xx-small;">
</td>
</tr>
</table>
</asp:WizardStep>
<asp:CreateUserWizardStep runat="server" Title="User Info">
<ContentTemplate>
<table border="0">
<tr>
<td align="right" colspan="3" style="text-align:
center">
<strong>User Information<br />
BOLD - Required Field.<br />
<br />
</strong>
<span style="color: red"><strong>For
security reasons, no single quotes, double quotes,
<br />
or special
characters accepted (astericks,
etc...)</strong></span><br />
</td>
</tr>
<tr>
<td align="right" style="width: 115px">
<asp:Label ID="UserNameLabel" runat="server"
AssociatedControlID="UserName" Font-Bold="True">User/Team
Name:</asp:Label></td>
<td style="width: 144px; font-style: italic;">
<asp:TextBox ID="UserName"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="UserNameRequired" runat="server" ControlToValidate="UserName"
ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="CreateUserWizard3"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
</td>
<td style="width: 132px; color: blue; height:
22px">
</td>
</tr>
<tr>
<td align="right" style="width: 115px">
<asp:Label ID="PasswordLabel" runat="server"
AssociatedControlID="Password" Font-Bold="True">Password:</asp:Label>
<em><span style="color:
red"></span></em></td>
<td style="width: 144px">
<asp:TextBox ID="Password" runat="server"
TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator
ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required."
ToolTip="Password is required." ValidationGroup="CreateUserWizard3"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
<strong>
<br />
</strong>
<asp:CompareValidator
ControlToCompare="Password" ControlToValidate="ConfirmPassword"
Display="Dynamic" ErrorMessage="The Password and Confirmation Password must
match." ID="PasswordCompare" runat="server"
ValidationGroup="CreateUserWizard1"
Width="134px"></asp:CompareValidator><strong>
</strong>
</td>
<td style="width: 132px; color: blue; height:
22px; font-weight: bold;">
<span style="color: blue">Passwords <span>
MUST</span> be a minimum of 7
characters; at least 1 non-alphanumeric character. This is for your
security.</span></td>
</tr>
<tr>
<td align="right" style="width: 115px">
<asp:Label ID="ConfirmPasswordLabel"
runat="server" AssociatedControlID="ConfirmPassword"
Font-Bold="True">Confirm Password:</asp:Label></td>
<td style="width: 144px">
<asp:TextBox ID="ConfirmPassword"
runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator
ID="ConfirmPasswordRequired" runat="server"
ControlToValidate="ConfirmPassword"
ErrorMessage="Confirm Password is
required." ToolTip="Confirm Password is required."
ValidationGroup="CreateUserWizard3"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
</td>
<td style="width: 132px; color: blue; height:
22px">
</td>
</tr>
<tr>
<td align="right" style="width: 115px">
<asp:Label ID="EmailLabel" runat="server"
AssociatedControlID="Email" Font-Bold="True">E-mail:</asp:Label></td>
<td style="width: 144px">
<asp:TextBox ID="Email"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="EmailRequired" runat="server" ControlToValidate="Email"
ErrorMessage="E-mail is required."
ToolTip="E-mail is required." ValidationGroup="CreateUserWizard3"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator
ID="RegularExpressionValidator1" runat="server" ControlToValidate="Email"
ErrorMessage="Bad email format"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Bad
format</asp:RegularExpressionValidator></td>
<td style="width: 132px; color: blue; height:
22px">
Must be a valid email address or your
account will be rejected.</td>
</tr>
<tr>
<td align="right" colspan="2" style="text-align:
center">
<strong>
If You Forget Your Password</strong></td>
<td align="right" colspan="1" style="width:
132px; color: blue; height: 22px">
</td>
</tr>
<tr>
<td align="right" style="width: 115px">
<asp:Label ID="QuestionLabel" runat="server"
AssociatedControlID="Question" Font-Bold="True">Security
Question:</asp:Label></td>
<td style="width: 144px">
<asp:TextBox ID="Question"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="QuestionRequired" runat="server" ControlToValidate="Question"
ErrorMessage="Security question is
required." ToolTip="Security question is required."
ValidationGroup="CreateUserWizard3"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
</td>
<td style="width: 132px; color: blue; height:
22px">
A question that only you will know the answer
to.</td>
</tr>
<tr>
<td align="right" style="height: 22px; width:
115px;">
<asp:Label ID="AnswerLabel" runat="server"
AssociatedControlID="Answer" Font-Bold="True">Security
Answer:</asp:Label></td>
<td style="height: 22px; width: 144px;">
<asp:TextBox ID="Answer"
runat="server"></asp:TextBox>
<asp:RequiredFieldValidator
ID="AnswerRequired" runat="server" ControlToValidate="Answer"
ErrorMessage="Security answer is
required." ToolTip="Security answer is required."
ValidationGroup="CreateUserWizard3"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
</td>
<td style="width: 132px; color: blue; height:
22px">
The answer to the question above.</td>
</tr>
</table>
<asp:Label ID="ErrorMessage" runat="server"
ForeColor="Red"></asp:Label>
</ContentTemplate>
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep runat="server" Title="Finished">
</asp:CompleteWizardStep>
</WizardSteps>
<SideBarStyle BackColor="#5D7B9D" BorderWidth="0px"
Font-Size="0.9em" VerticalAlign="Top" />
<TitleTextStyle BackColor="#5D7B9D" Font-Bold="True"
ForeColor="White" />
<SideBarButtonStyle BorderWidth="0px" Font-Names="Verdana"
ForeColor="White" />
<NavigationButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" ForeColor="#284775" />
<HeaderStyle BackColor="#5D7B9D" BorderStyle="Solid"
Font-Bold="True" Font-Size="0.9em"
ForeColor="White" HorizontalAlign="Center" />
<CreateUserButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" ForeColor="#284775" />
<ContinueButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC"
BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" ForeColor="#284775" />
<StepStyle BorderWidth="0px" />
<MailDefinition BodyFileName="~/NewRacer.txt" From="(e-mail address removed)"
CC="(e-mail address removed)" IsBodyHtml="True"
Subject="MySite.com New Racer Profile Submission">
</MailDefinition>
</asp:CreateUserWizard>
 
Joined
May 11, 2006
Messages
2
Reaction score
0
I found a solution as below:

Protected Sub CreateUserWizard1_NextButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles CreateUserWizard1.NextButtonClick

Validate()
e.Cancel = Not IsValid

End Sub

I am not sure this is the best way though.

Kazu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top