Solved

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

Posted on 2004-04-05
6
134 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
[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
  • 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
Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

 

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

627 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