Solved

Error Messages on a web form

Posted on 2012-03-21
2
179 Views
Last Modified: 2012-06-27
Hi Everyone,

I need to place error messages on fields when they are left blank and they are required and must be numeric or alphabetic characters.

Where do I place an error message on say the Driver License Number left blank.  I know I can place messages when I try to add the record on an event button "ADD New", but I want the message to appear if the user selects enter or tabs to the next field or when the field loses focus.  Where do I do this.  I tried to do it in the textChanged event of the field, but the message does not appear when I select enter or tab to the next field.

jjc9809
0
Comment
Question by:jjc9809
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Expert Comment

by:Lalit Chandra
ID: 37748264
you can try the below technique to solve your problem

<script>
function emailcheck(){
var string1=document.example.email.value
if (string1.indexOf("@")==-1){
.alert("Please input a valid email address!")
.document.example.email.focus()
.}
}
</script>

<form name="example"><input type="text" size="20" name="email" onblur="emailcheck()">
<strong>Feedback please:</strong>
<textarea name="S1" rows="2" cols="20"></textarea>
<input type="submit" name="B1" value="Submit">
</form>
0
 
LVL 29

Accepted Solution

by:
Paul Jackson earned 500 total points
ID: 37748278
PLease have a look at the linked article which describes using validation controls in asp.net, these controls check validation on the server side but also can be enabled to check validation on the clientside such as when leaving a field.

Vaidating USer INput in ASP.Net

Client-Side validation for asp.net Server-Controls
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question