Solved

Error Messages on a web form

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

19 Experts available now in Live!

Get 1:1 Help Now