Question

Validation of textbox entries and how to disable "Tabbing"

Asked by: dmasini

Experts,

Newbie here so I will try to explain the issue as well as possible.  So I have this page where (thanks to the_bachelor) that we pass params for a record number which I will eventually send out as an HTML-formatted e-mail vias aspNetMail (nice product by the way!).

Now I want make sure that I get the following:

1) In TextBox1 I want a valid e-mail (for now only has to be formatted properly...name@domain.TLD)
2) In TextBox2 I want a valid qty they want to order
3) In TextBox3 I want a valid date they need the product

Just FYI...I know how to apply "RequiredFieldValidators", "RegularExpressionValidators" and "RangeValidators" and "ValidatorCalloutExtenders" etc.

The problem is when I run my page I am able to just "TAB" through the fields even though I "SetFocusOnError".  I want to ALWAYS force the cursor back to the focused texbox if it DOES not validate properly.

Any ideas/thoughts would be appreciated!  Code Snippet included for your review.

Thanks again,

DM

<%@ Page Language="VB" %>
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 
<script runat="server">
 
    Dim DoEmailSend As Boolean = False
    Dim RecordID2 As Int32
 
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
 
        DoEmailSend = True
        
    End Sub
    
    Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
 
        'create a new HtmlTextWriter so we can get at the page's source
        Dim stringWriter As New IO.StringWriter()
        Dim htmlWriter As New HtmlTextWriter(stringWriter)
  
        'render the page
        MyBase.Render(htmlWriter)
 
        'get the html source of the current page
        Dim html As String = stringWriter.ToString()
 
        If DoEmailSend Then
            'send it as an email
            SendEmail(html)
        End If
   
        'send to the browser
        writer.Write(html)
    End Sub 'Render
 
    Sub SendEmail(ByVal html As String)
        'create an email object, and set the mail server = "mail.mycompany.com"
        Dim msg As aspNetEmail.EmailMessage = New aspNetEmail.EmailMessage("win2003.guicorporation.com")
        
        
        'set recipient error logging off
        msg.IgnoreRecipientErrors = True
        
        'set exception throwing off
        msg.ThrowException = False
 
        '****************************************************************
        '*** These lines removed to address issue with stripping off pulldowns when sending 
        '*** HTML pages via e-mail.  Replaced with new dll 3.6.0.12
        '*** msg.Body = html
        '*** since we are loading a html page, set the bodyformat
        '*** msg.BodyFormat = aspNetEmail.MailFormat.Html
        '****************************************************************
        
        'set logging on
        msg.Logging = True
        msg.LogPath = "c:\aspNetMail-Logs\aspnetmail.log"
        
        msg.WriteLineToLog("======= START RAW HTML =======")
        msg.WriteLineToLog(html)
        msg.WriteLineToLog("======= END RAW HTML =======")
        
        
        Dim hu As New aspNetEmail.HtmlUtility(msg)
        hu.LoadString(html, Nothing)
        hu.HtmlRemovalOptions = hu.HtmlRemovalOptions Or aspNetEmail.HtmlRemovalOptions.EventArgument Or aspNetEmail.HtmlRemovalOptions.InputHiddenTag Or aspNetEmail.HtmlRemovalOptions.InputSubmitTag Or aspNetEmail.HtmlRemovalOptions.ReplaceSelectTagWithSelectedText Or aspNetEmail.HtmlRemovalOptions.ReplaceInputTextAreaWithValue
 
        hu.Render()
 
        msg = hu.ToEmailMessage()
        
        'set the from address
        msg.FromAddress = TextBox1.Text
        
 
        'set the to address
        msg.To = "dmasini@guicorporation.com"
        
        
        'set the Misc Comment line
        msg.Subject = TextBox3.Text
        
 
        'set the content encoding
        msg.ContentTransferEncoding = aspNetEmail.MailEncoding.QuotedPrintable
        
 
        'send the email
        msg.Send()
 
    End Sub
     
</script>
    
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Request a Quote via E-Mail</title>
    </head>
<body>
    <form id="form1" runat="server">
 
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <br />
        <table style="width: 564px; border-left-color: silver; border-bottom-color: silver; border-top-style: ridge; border-top-color: silver; border-right-style: ridge; border-left-style: ridge; border-right-color: silver; border-bottom-style: ridge;">
            <tr>
                <td style="height: 381px; width: 314px;">
                    <table id="TABLE1" style="width: 528px" language="javascript" onclick="return TABLE1_onclick()">
                        <tr>
                            <td bgcolor="maroon" style="height: 24px" colspan="2">
                            <asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Names="Verdana"
            Font-Size="Small" ForeColor="DarkBlue" Text="Quote Form..." style="font-weight: bold; font-size: 10pt; color: white; font-family: verdana"></asp:Label></td>
                        </tr>
                        <tr>
                            <td colspan="2" style="border-left-color: navy; border-bottom-color: navy; border-top-style: solid;
                                border-top-color: navy; border-right-style: solid; border-left-style: solid;
                                height: 29px; border-right-color: navy; border-bottom-style: solid">
                                <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Names="Verdana" ForeColor="Navy"
                                    Style="text-align: center" Text="(Please provide a quote for the following item...)" Font-Size="Medium"></asp:Label></td>
                        </tr>
                        <tr>
                            <td style="height: 25px; width: 489px; text-align: right; background-color: gray;">
                                <strong style="border-top-width: thin; font-weight: bold; border-left-width: thin; border-left-color: gray; border-bottom-width: thin; border-bottom-color: gray; color: white; border-top-color: gray; border-right-width: thin; border-right-color: gray"> Your E-Mail:</strong></td>
                            <td style="width: 285055px; height: 25px">
                                &nbsp;<asp:TextBox ID="TextBox1" runat="server" Width="252px" Height="40px" CausesValidation="True" AutoCompleteType="Email" Wrap="False">enter your e-mail address here</asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                                    ErrorMessage="(cannot be blank)" Height="24px" SetFocusOnError="True" Style="position: absolute"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
                                    ErrorMessage="(valid e-mail format required)" SetFocusOnError="True" Style="left: 340px;
                                    position: absolute; top: 136px" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                    Width="200px"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 24px; text-align: right; font-weight: bold; color: white; background-color: gray;">
                                <strong> To:</strong></td>
                            <td style="width: 285055px; height: 24px; font-weight: bold; font-size: 12pt; color: black; font-family: Arial;">
                                sales@hpoll.com</td>
                        </tr>
                        <tr>
                            <td style="height: 24px; text-align: right; font-weight: bold; color: white; background-color: gray;">
                                <strong>Subject:</strong></td>
                            <td style="width: 285055px; height: 24px; font-weight: bold; font-size: 12pt; font-family: Arial;">
                                Please provide a quote for the following item...</td>
                        </tr>
                        <tr>
                            <td style="font-weight: bold; height: 20px; text-align: right; border-top-width: thin; border-left-width: thin; border-left-color: blue; border-bottom-width: thin; border-bottom-color: blue; vertical-align: top; color: white; border-top-color: blue; background-color: gray; border-right-width: thin; border-right-color: blue;">
                                Note:</td>
                            <td style="width: 285055px; height: 20px">
                                <asp:TextBox ID="TextBox3" runat="server" Height="56px" Width="256px" ToolTip="Enter any misc notes here..." style="cursor: text"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td bgcolor="maroon" style="height: 24px" colspan="2">
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="height: 24px">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                    <asp:Label ID="Label3" runat="server" Text="QUANTITY REQUIRED:" Width="204px" style="text-align: right" BackColor="#FFFFC0" Font-Bold="True" Font-Size="Medium"></asp:Label>
                    <asp:TextBox ID="TextBox2" runat="server" Width="96px"></asp:TextBox>
                    <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox2"
                        ErrorMessage="(Minimum 1 - Maximum 999999)" MaximumValue="999999" MinimumValue="1"
                        SetFocusOnError="True" Style="position: absolute"></asp:RangeValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox1"
                        ErrorMessage="(qty must be 1 or greater)" InitialValue="0" SetFocusOnError="True"
                        Style="position: absolute"></asp:RequiredFieldValidator>
                    <br />
                    <asp:Label ID="Label4" runat="server" BackColor="#FFFFC0" Font-Bold="True" Font-Size="Medium"
                        Style="text-align: right" Text="DATE REQUIRED:" Width="204px"></asp:Label>
                    <asp:TextBox ID="TextBox4" runat="server" CausesValidation="True" ToolTip="Click here to select a date required..."
                        Width="96px"></asp:TextBox>
                    <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox4">
                    </cc1:CalendarExtender>
                    <br />
                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
                        DataSourceID="SqlDataSource2" Height="136px" Width="532px">
                        <Fields>
                            <asp:BoundField DataField="RecordID" HeaderText="RecordID:" InsertVisible="False"
                                SortExpression="RecordID">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CTMFGNAME" HeaderText="Vendor:" SortExpression="CTMFGNAME">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CTCATALOG" HeaderText="Catalog:" SortExpression="CTCATALOG">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CTDESCRIPTION" HeaderText="Description:" SortExpression="CTDESCRIPTION">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="DISTSKU" HeaderText="NAED V/I:" SortExpression="DISTSKU">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="COMMODITYNAME" HeaderText="Category:" SortExpression="COMMODITYNAME">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CTUM" HeaderText="Sold By:" SortExpression="CTUM">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="ShippedQtyPAM" HeaderText="Qty in Stock:" SortExpression="ShippedQtyPAM">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" Width="200px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CurrSellPricePAM" DataFormatString="{0:c}" HeaderText="List Price:"
                                HtmlEncode="False" SortExpression="CurrSellPricePAM">
                                <HeaderStyle Font-Bold="True" Font-Size="Small" HorizontalAlign="Right" />
                            </asp:BoundField>
                        </Fields>
                        <HeaderStyle BackColor="#FFFFC0" HorizontalAlign="Right" VerticalAlign="Top" />
                        <PagerSettings Position="Top" />
                        <RowStyle BackColor="#FFFBD6" />
                        <FieldHeaderStyle BackColor="#FFFF99" ForeColor="#404040" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:DetailsView>
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Send..." style="width: 200px; cursor: hand;" OnClientClick='alert("Page Captured.  Click OK to Send!")' />
                                <asp:Button ID="Button2" runat="server" OnClientClick="window.close()" Style="width: 200px; cursor: hand;"
                                    Text="Close this Window..." /><br />
                    <asp:Panel ID="Panel1" runat="server" Height="50px" Style="width: 500px; font-weight: bold; font-size: 8pt; color: silver; font-family: verdana; height: 200px;" Width="125px">
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;
                        &nbsp; &nbsp; &nbsp;&nbsp;
                        <br />
                        <br />
                        (To prevent Spam the originating IP Address was:
                        <%=Request.ServerVariables("REMOTE_ADDR")%>)
                        <br />
                        <br />
                        &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                        ********************** ** LEGAL DISCLAIMER ************************
                        <br />
                        This E-mail message and any attachments may contain legally privileged, confidential
                        or proprietary information. If you are not the intended recipient(s), or the employee
                        or agent responsible for delivery of this message to the intended recipient(s),
                        you are hereby notified that any dissemination, distribution or copying of this
                        E-mail message is strictly prohibited. If you have received this message in error,
                        please immediately notify the sender and delete this E-mail message from your computer.<br />
                    </asp:Panel>
                </td>
            </tr>
        </table>
        <br />
        &nbsp;<br />
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:IDC_Receiving %>"
                          
                        SelectCommand="SELECT [CTMFGNAME], [CTDESCRIPTION], [DISTSKU], [CTUM], [COMMODITYNAME], [RecordID], [CTCATALOG], [IDCPROPPRICE], [ShippedQtyPAM], [CurrSellPricePAM] FROM [Cooper-Master-Items-Table] WHERE (([IDCPROVIDERCODE] = @IDCPROVIDERCODE) AND ([RecordID] = @RecordID2))">
                        <SelectParameters>
                            <asp:Parameter DefaultValue="IDC001" Name="IDCPROVIDERCODE" Type="String" />
                            <asp:QueryStringParameter Name="RecordID2" QueryStringField="RecordID2" Type="Int32" />
                        </SelectParameters>
                    </asp:SqlDataSource>
        &nbsp;<br />
        &nbsp;<br />
        <br />
        <br />
        <br />
        <br />
    
    </div>
    </form>
</body>
</html>

                                  
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:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-03-28 at 17:51:55ID23278888
Tags

Microsoft

,

Visual Web Developer 2005

Topic

Active Server Pages (ASP)

Participating Experts
1
Points
500
Comments
5

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Excel Textbox focus
    This question is in regards to Excel VBA. I need help with the syntax for focusing on a textbox. Basically I’m validating a spreadsheet with textboxes to make sure that all the values inputted are valid, when an invalid value is found, I want the focus to be set to the text...
  2. validate two textboxes
    HI, i have 2 textboxes: textbox1 textbox2 when user keys in the number for these textboxes and hit submit. Onblur i want to validate. How do i prevent user keys in the same number. When user keys in the same number for these two textboxes and an alert ...
  3. Say I have TextBox1, TextBox2, TextBox3...etc is …
    Hey guys, say I have 4 text boxes, in this case i'll just say they are TextBox1, TextBox2, TextBox3 and TextBox4. Now lets say I want to write a small routine that will clear all of them would i have to do TextBox1.Text = ""; TextBox2.Text = ""; TextBo...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: sybePosted on 2008-03-29 at 03:43:36ID: 21236110

>  want to ALWAYS force the cursor back to the focused texbox if it DOES not validate properly.

Sorry, but that is not going to work. Such validation is done on the client, using javascript. Simply turning off javascript will break your functionality.

You can use client-side validation, which detects unvalidated formvalues before the form is submitted. But there are many ways a user can avoid such client-side validation.

So you are stuck to do server-side validation as well. Server-side validation can be done only when soething is submitted to the server.

 

by: dmasiniPosted on 2008-03-30 at 08:35:20ID: 21241002

sybe,

Thanks for responding...I guess what your saying is that runat="server" (in this snippet) is not the same thing?

<asp:TextBox ID="TextBox1" runat="server" Width="252px" Height="40px" CausesValidation="True" AutoCompleteType="Email" Wrap="False">enter your e-mail address here</asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"ErrorMessage="(cannot be blank)" Height="24px" SetFocusOnError="True" Style="position: absolute"></asp:RequiredFieldValidator><asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="(valid e-mail format required)" SetFocusOnError="True" Style="left: 340px;
position: absolute; top: 136px" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Width="200px"></asp:RegularExpressionValidator>

ANY ideas or links to places where I could get a better grasp of the concept would be appreciated!

Thanks again,

dm

 

by: sybePosted on 2008-03-31 at 00:09:56ID: 21243619

I am not very familiar with dot.Net code (and this seems to be the classic ASP area).

The principle is not so hard to understand.

1. ASP code on the server generates HTML.
2. The HTML is send from the server to the browser (the client).
3. On the client computer (which is a totally different computer as the server) something happens: a form is filled out. It is important to realize that functions that are located on the server, will do nothing at this point. If you would shut down the server after sending the HTML to the client, the HTML remains available on the client. The form can still be filled out.

It is in this phase that client-side-validation can happen. Client-side validation is carried out by scripts that are included in the HTML, and which are send to the browser. They run on the client. They do NOT run on the server.

4. Only when the form is submitted to the server, the scripts on the server are activated. Only now server-side validation can take place. Because the form has been submitted, the browser waits for the server to respond. The browser expects a new HTML-page. If the form-values do not validate, the only thing to do is to send back a new HTML page, with notification that the form is not filled out correctly.

-----
You are clearly talking about things happening during phase #3. Tabbing and focusing are things that happen in the browser.

For the browser it does not matter how the code is generated, the browser just gets HTML. It makes no difference is the HTML is generated through Dot.Net code or through Classic ASP or PHP or whatever. The only thing that matters to the browser is what the HTML looks like.

Once you realize the difference between client-side validation (and phase #3) and server-side validation (at phase #4), you'll understand better.

 

by: dmasiniPosted on 2008-03-31 at 18:06:20ID: 21250506

sybe,

I have been digging into server-side validation in more depth...your overview was extremely clear so I know where I need to focus.  In the interim I added a .NET ConfirmButtonExtender that will popup informing the user that they need to "Ensure you have provided a valid e-mail, quantity required and needed date...Click OK to Send or Cancel to modify your entries".

As a bonus I noted that when ConfirmButtonExtender was invoked any individual field that DID NOT validate properly (i.e. invalid e-mail format OR qty is blank, zero or less than 1 OR needed date is blank or does not meet mm/dd/yyyy format) the validator text will display.  Good start.

I thank you for your time and will Accept as Solution!

Regards,

dm

 

by: dmasiniPosted on 2008-03-31 at 18:07:48ID: 31443986

Sybe,

Thanks again!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...