Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 4th, 2005, 08:00 PM
Authorized User
Join Date: Mar 2005
Location: , , .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Textbox Validation

Hi Imar,

I'm using ASP.NET with Dreamweaver MX 04 to create a customer's information form. There are some textboxes and dropdown menus that I would like to validate before the form can be sent to the server. I've used the validation tag (ASP.NET) but everytime I click the "ADD BUTTON" and the form is sent to database without any validation. Could you please advise. Thanks

Here the code:

<td colspan="4" align="right" nowrap><div align="left">
        <asp:DropDownList id="FieldOfficeTeamACOCode" runat="server">
          <asp:ListItem value="0">Choose one</asp:ListItem>
          <asp:ListItem value="NDA (Norwalk)">NDA (Norwalk)</asp:ListItem>
          <asp:ListItem value="NDB (Norwalk)">NDB (Norwalk)</asp:ListItem>
          <asp:ListItem value="NDC (Norwalk)">NDC (Norwalk)</asp:ListItem>
          <asp:ListItem value="NIA (Irvine)">NIA (Irvine)</asp:ListItem>
          <asp:ListItem value="NIB (Irvine)">NIB (Irvine)</asp:ListItem>
          <asp:ListItem value="NID (Irvine)">NID (Irvine)</asp:ListItem>
          <asp:ListItem value="NOB (Ontario)">NOB (Ontario)</asp:ListItem>
          <asp:ListItem value="NOF (Ontario)">NOF (Ontario)</asp:ListItem>
          <asp:ListItem value="NOG (Ontario)">NOG (Ontario)</asp:ListItem>
          <asp:ListItem value="NJA (NG)">NJA (NG)</asp:ListItem>
          <asp:ListItem value="NJB (NG)">NJB (NG)</asp:ListItem>
          <asp:ListItem value="NJP (NG)">NJP (NG)</asp:ListItem>
          <asp:ListItem value="NHB (Raytheon)">NHB (Raytheon)</asp:ListItem>
          <asp:ListItem value="NHC (Raytheon)">NHC (Raytheon)</asp:ListItem>
          <asp:ListItem value="NHE (Raytheon)">NHE (Raytheon)</asp:ListItem>
          <asp:ListItem value="NHF (Retheon)">NHF (Retheon)</asp:ListItem>
          <asp:ListItem value="NHH (Reytheon)">NHH (Reytheon)</asp:ListItem>
        <asp:RequiredFieldValidator ControlToValidate="FieldOfficeTeamACOCode" Display="Dynamic" ErrorMessage="Required!" ID="rfvFOTAC" InitialValue="0" runat="server" />
<tr valign="baseline">
      <td align="right" nowrap><div align="right">PrimeContractorName:</div></td>
      <td colspan="4" align="right" nowrap><div align="left">
        <asp:textbox id="PrimeContractorName" TextMode="SingleLine" Columns="32" runat="server" />
      <asp:RequiredFieldValidator ControlToValidate="PrimeContractorName" Display="Dynamic" ErrorMessage="Required!" ID="rfvPrimeCont" runat="server" /></div></td>


<input name="btnAdd" type="submit" id="btnAdd" value="Add "/>
Old May 8th, 2005, 09:17 AM
Authorized User
Join Date: Apr 2005
Location: Brum, , United Kingdom.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rain_uk

The way i know how to validate is to click on the Insert or Submit button on your form, then go to the Tag box on the right, click the + icon then select Validate near the bottom. Then just tick the fields you want to validate.

Hope this helps :)

Old May 9th, 2005, 02:47 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

I don't think you can use regular submit buttons to trigger validation.

Change this:

<input name="btnAdd" type="submit" id="btnAdd" value="Add "/>

to something like this:

<asp:Button id="btnAdd" runat="server" Text="Add" />

For these kind of questions, I think you can better post in a .NET forum instead of a Dreamweaver forum....

rain_uk: Your solution works for client side validation only where DW generates JavaScript for validation. However, the ASP.NET validation controls are much more powerful than that as they also validate on the server....


Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Forever Changed by Lou Reed & John Cale (Track 14 from the album: Songs For Drella) What's This?

Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox entry validation thillai Visual Basic 2005 Basics 6 February 20th, 2008 07:23 AM
Textbox validation rhd110 .NET Framework 2.0 1 March 28th, 2007 02:49 PM
textbox validation in c# dhol C# 3 July 22nd, 2005 05:57 AM
TextBox Validation Brettvan1 VB.NET 2002/2003 Basics 1 June 23rd, 2005 08:58 AM
validation on textbox noor ASP.NET 1.0 and 1.1 Basics 2 May 4th, 2005 02:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.