Solved

error messages linked to the place where the user has to fill out the fields

Posted on 2004-04-05
6
128 Views
Last Modified: 2010-04-09
if i have a page for the user to submit some information and i have put some error messages in the beggining of the page in case the user forgets to fill out some text field,  how can i make those error messages directly linked to the place where the user has to fill out the fields ? I use html with ASP but java/vb script is also fine. It would be nice if when the user click on the error message, the mouse cursor appears directly in the field which the user has to fill in.
Thanks
0
Comment
Question by:Carl3003
  • 4
6 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10762394
Simple javascript/VB script is enough....


<script language="JavaScript">
var currentURL = window.location+"";
//alert(currentURL.value);
if (currentURL.indexOf("msg=") != -1)
{
  var qry=currentURL.split("=");
  var msg=qry[1];
  msg=msg.replace("%20"," ");
  document.write('<H2>Error  Message:' +msg+'</H2>');
}
</script>

<a href="?msg=Invliad data"> check errromsg </a>

for jumping into specific field,....
you can say...

formelement.focus();
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10762403
In asp,

<%

dim msg
msg  = request("msg")
Response.write "Error message = " & msg

%>

0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10762411
for focus on an element....

<script>
function setfocus()
{
document.forms[0].searchcontent.focus();
}
</script>

<BODY onload=setfocus()>
0
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.

 

Author Comment

by:Carl3003
ID: 10762786
I already have an error msg. I just need to know how to make a "key" word or picture after the error message which links me to the text/area field without the user need to scroll down. Little example would be very helpful and appreciated.
Thanks
0
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 150 total points
ID: 10763430
Make a hyper link of the error message as follows
<a href="#errorloc"> Error message </a>


and near the textbox or the filed where there is a error
include this tag..

<a name="errorloc">
<input type=text>
.
..
</a>
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 100 total points
ID: 10769509
If you want to focus back to the input field use this:
<div id="error1"
style="display:none;z-index:10;position:absolute;top:100px;left:100px;background-color:white;">
<a href="#" onClick="document.forms{'formname'].fieldname.focus()">
Your error message</a></div>

Then in the validation scripting when you find an error just add:
document.getElementById('error1').style.display='block';


Cd&
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

Suggested Solutions

Title # Comments Views Activity
Radio button Onclick submit form with validation 5 44
wordpress url rewriting plugin 5 46
HTML File in SharePoint 2013 Library 4 47
Javascript Hashmap output 8 46
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 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

13 Experts available now in Live!

Get 1:1 Help Now