C
Code Rodent
Hi there,
Please please could someone shed some like on a problem that I'm having
using a combination of Wizards, ValidationGroups and ValidationSummary
controls. What I want to do is to have a wizard that will take me through
several steps, and at each step validate input data using
RequiredFieldValidators etc. displaying any errors in a Validation Summary.
The problem that I have is that I cannot seem to have a ValidationSummary
control on each step of the wizard and get client side validation to take
place. If I remove the summary control from the second step of the wizard,
then all is well and client side validation takes place.
I've broken the problem down to it's most simple form see code below which
demonstrates the problem.
I've struggled for many hours to track the problem down to this, so I'm
hoping that some kind person can show me the error of my ways or provide an
acceptable work around. I do need to have the summary panel on each step
though, so thinking caps on..
Thanks in advance
Andy
<h1>If you can leave the edit control empty and click on the next button
then the client side validation is NOT working!</h1>
<asp:Wizard ID="Wizard1" runat="server" DisplaySideBar="false">
<WizardSteps>
<asp:WizardStep runat="server" Title="Step 1">
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 2">
</asp:WizardStep>
</WizardSteps>
<StartNavigationTemplate>
<asp:Label ID="_lblPostCode" runat="server"
AssociatedControlID="_txtPostCode">PostCode:</asp:Label>
<asp:TextBox ID="_txtPostCode" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="_txtPostCode"
ErrorMessage="A postcode need is required and must be in the form BN43 5HF."
ToolTip="A postcode is is required."
ValidationGroup="_register">*</asp:RequiredFieldValidator>
<asp:Button ID="Button1" runat="server" Text="Next" CommandName="MoveNext"
ValidationGroup="_register"/>
<asp:ValidationSummary ID="changePasswordSummary" runat="server"
ValidationGroup="_register" />
</StartNavigationTemplate>
<FinishNavigationTemplate>
<asp:Label ID="_lblExpiry" runat="server"
AssociatedControlID="_txtExpiry">Expiry:</asp:Label>
<asp:TextBox ID="_txtExpiry" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="_txtExpiry"
ErrorMessage="A card expiry date is required and must be in the form MM/YY."
ToolTip="A card expiry date is required."
ValidationGroup="_expiry">*</asp:RequiredFieldValidator>
<asp:Button ID="Button2" runat="server" Text="Finished"
CommandName="MoveEnd" ValidationGroup="_expiry"/>
<asp:ValidationSummary ID="changePasswordSummary" runat="server"
ValidationGroup="_expiry" />
</FinishNavigationTemplate>
</asp:Wizard>
Please please could someone shed some like on a problem that I'm having
using a combination of Wizards, ValidationGroups and ValidationSummary
controls. What I want to do is to have a wizard that will take me through
several steps, and at each step validate input data using
RequiredFieldValidators etc. displaying any errors in a Validation Summary.
The problem that I have is that I cannot seem to have a ValidationSummary
control on each step of the wizard and get client side validation to take
place. If I remove the summary control from the second step of the wizard,
then all is well and client side validation takes place.
I've broken the problem down to it's most simple form see code below which
demonstrates the problem.
I've struggled for many hours to track the problem down to this, so I'm
hoping that some kind person can show me the error of my ways or provide an
acceptable work around. I do need to have the summary panel on each step
though, so thinking caps on..
Thanks in advance
Andy
<h1>If you can leave the edit control empty and click on the next button
then the client side validation is NOT working!</h1>
<asp:Wizard ID="Wizard1" runat="server" DisplaySideBar="false">
<WizardSteps>
<asp:WizardStep runat="server" Title="Step 1">
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 2">
</asp:WizardStep>
</WizardSteps>
<StartNavigationTemplate>
<asp:Label ID="_lblPostCode" runat="server"
AssociatedControlID="_txtPostCode">PostCode:</asp:Label>
<asp:TextBox ID="_txtPostCode" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="_txtPostCode"
ErrorMessage="A postcode need is required and must be in the form BN43 5HF."
ToolTip="A postcode is is required."
ValidationGroup="_register">*</asp:RequiredFieldValidator>
<asp:Button ID="Button1" runat="server" Text="Next" CommandName="MoveNext"
ValidationGroup="_register"/>
<asp:ValidationSummary ID="changePasswordSummary" runat="server"
ValidationGroup="_register" />
</StartNavigationTemplate>
<FinishNavigationTemplate>
<asp:Label ID="_lblExpiry" runat="server"
AssociatedControlID="_txtExpiry">Expiry:</asp:Label>
<asp:TextBox ID="_txtExpiry" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="_txtExpiry"
ErrorMessage="A card expiry date is required and must be in the form MM/YY."
ToolTip="A card expiry date is required."
ValidationGroup="_expiry">*</asp:RequiredFieldValidator>
<asp:Button ID="Button2" runat="server" Text="Finished"
CommandName="MoveEnd" ValidationGroup="_expiry"/>
<asp:ValidationSummary ID="changePasswordSummary" runat="server"
ValidationGroup="_expiry" />
</FinishNavigationTemplate>
</asp:Wizard>