Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem with ValidationSummary/Validation groups and Wizards

Reply
Thread Tools

Problem with ValidationSummary/Validation groups and Wizards

 
 
Code Rodent
Guest
Posts: n/a
 
      05-04-2006
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>




 
Reply With Quote
 
 
 
 
SpinMap SpinMap is offline
Junior Member
Join Date: Aug 2006
Posts: 1
 
      08-04-2006
Hi,

I'm having a similar problem, and seem to have tracked it down to the "StartNavigationTemplate" created by VS2005 in my Wizard.

I first noticed it on a CreateUserWizard page, and a regular Wizard on another page that I use to let users edit their profiles. The client-side validations work for me, but the server side validation does not work. I discovered it because my custom validators (no client-side script) didn't work at all.. and then when I set EnableClientScript to false on the other validators, they did not work on the server either.

Anyway, I re-built the page from scratch until the problem re-appeared. Didn't take long... I discovered that it seems to come from converting to a StartNaviagationTemplate. As you can see in the code below, I created a simple wizard page, added a single textbox, and a RequiredFieldValidator (with EnableClientScript="False"). It works with the simple 2-step wizard that VS2005 creates... validates as expected. But when I use VS2005 to "Convert to StartNavigationTemplate", with no other changes... it stops validating.

So... anyone have any ideas? Is this a bug in ASP? Maybe a bug in the way VS2005 implements the Navigation Template? Is there something I'm missing?? Any ideas how to fix or get around this???

Thanks for any advice!!



Validation Works:

<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" DisplaySideBar="False">
<WizardSteps>
<asp:WizardStep runat="server" Title="Step 1">
<asp:TextBox ID="TextBox1" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="TextBox1"
ErrorMessage="RequiredFieldValidator"
EnableClientScript="False"/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 2" />
</WizardSteps>
</asp:Wizard>


Validation Does Not work!!:

<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" DisplaySideBar="False">
<WizardSteps>
<asp:WizardStep runat="server" Title="Step 1">
<asp:TextBox ID="TextBox1" runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="TextBox1"
ErrorMessage="RequiredFieldValidator"
EnableClientScript="False"/>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 2" />
</WizardSteps>
<StartNavigationTemplate>
<asp:Button ID="StartNextButton" runat="server"
CommandName="MoveNext" Text="Next" />
</StartNavigationTemplate>
</asp:Wizard>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VS.NET/class design/OO wizards: Please evaluate my scheme for abstracting the details of my applications and database ASP .Net 1 03-16-2007 09:10 AM
Facing problem while using Wizards with Project Templates !!!!! Anubhav Jain ASP .Net 0 03-20-2006 09:16 AM
Panles and wizards control bannaman ASP .Net 0 02-16-2006 11:35 AM
Wizards and State Machines Tobin Harris ASP .Net 4 12-01-2004 09:45 AM
[STRUTS question] Validation, Input, and Wizards Bernie Wieser Java 1 08-25-2003 03:20 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57