Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-04-05
6
Medium Priority
?
136 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 600 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
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 elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

722 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