Solved

Error Messages on a web form

Posted on 2012-03-21
2
174 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
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now