Solved

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

Posted on 2004-04-05
6
127 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 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…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

705 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