Required Field Validator Does Not Block Postback

D

dinsdale

Wow, this is a really embarassing thing to have to ask about...

I have an asp.net page with a multiview control in it. We want to enter
person info in a semi - wizard style and I wanted to use required field
validators for, well required fields. On the first view, the person
enters first name, last name and a couple other things. the RFV works
great on first and last name and we move on to the next view -
Addresses. I want to be able to enter multiple addresses so I have an
update button that stores each address entered into a private variable
and clears the form for the next address (yes, it is set to
CauseValidation). The problem is the update button IS NOT causing
client side validation? WTF???

I thought this may be due to the views but I created a quick test
mockup with a MultiView, two views each with a button, a text field and
a RFV. It works every time.
Field and Validator:
<tr>
<th align="left" nowrap="nowrap">
Address One:
</th>
<td width="90%" align="left">
<asp:TextBox ID="txtAddressLineOne" runat="server"
MaxLength="100" Width="250px"></asp:TextBox>&nbsp;
<asp:RequiredFieldValidator id="rfvAddressLineOne"
runat="server" ErrorMessage="Address 1 is a
Required Field" ControlToValidate="txtAddressLineOne"
CssClass="ErrorMessage"
EnableClientScript="true">
*Required
</asp:RequiredFieldValidator>

</td>
</tr>


Button:

<asp:Button ID="btnUpdate" runat="server" Text="Update"
OnClick="btnUpdate_Click" CausesValidation="true"/>

Any ideas?

Dinsdale
 

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,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top