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

x
?
Solved

JSP and AJAX

Posted on 2006-12-01
6
Medium Priority
?
1,355 Views
Last Modified: 2013-11-24
I have a JSP in a web application that works like this:  There is an esn text field where users enter in the 11 digits serial number.  The moment the field loses focus (onblur), it will call a javascript method and AJAX to do some backend check and validation on the serial number.  If the esn is valid, nothing occurs but if invalid, a javascript popup messages appears saying "ESN Invalid..."

Now though, there is a new requirement where instead of popup messages, they want the messages to be displayed on the actual web page above the esn text field in red (like an error message).  Same function is used here where when onblur, validation is performed and if invalid, message dynamically appears on the web page.  However, I am at a loss as to how to do this.  How do I make messages appear above esn field and dynamically when onblur occurs?  I mean, through javascript, I can only make popup messages appear...

This web application is not written using struts but has its own framework.  

Any samples, ideas?  

If you don't understand the question, I can clarify.
0
Comment
Question by:Magneto_Mystique
[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
  • 2
  • 2
6 Comments
 
LVL 26

Accepted Solution

by:
ksivananth earned 400 total points
ID: 18058597
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 400 total points
ID: 18060142
> I mean, through javascript, I can only make popup messages appear...

Not really. You should have the text inside a <div> or an iframe tag that you will show and hide onBlur, something like:

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Test</title>
<script type="text/javascript">
<!--
window.onload = function()
{
      document.getElementById("afield").onblur = function()
      {
            document.getElementById("adiv").innerHTML = document.getElementById("afield").value;
      }
}
// --></script>
</head>
<body>
<form>
<input type="text" id="afield">
</form>
<div id="adiv"></div>
</body>
</html>

0
 
LVL 26

Expert Comment

by:ksivananth
ID: 18071904
Hi girionis, this is what exactly in the link I have posted!
0
 
LVL 35

Expert Comment

by:girionis
ID: 18074833
Hello ksivananth, I didn't look at your link when I posted. But now I am looking at it I can see that it is also talking about a div but it is not exactly the same, since I am using the onBlur() function while your link does not. Anyway, I am not here to steal points from you, so Magneto_Mystique if you go with the div solution please accept ksivananth's comment.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

715 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