File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Delay while I type characters in the text box

 
Naveen Morrise
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need help in how to code in such a way that, I should get all the elements of the xml document initially when the page first loads (or something like that) and store the elements in some JavaScript data structure. So that, for subsequent access I can access from that data structure rather than invoking the xml parsing api every time.
[ June 06, 2006: Message edited by: Bear Bibeault ]
 
Richard Green
Ranch Hand
Posts: 536
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AJAX?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Mike Corleone", you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naveen, your subject line and your topic seem to have little to do with each other. Please clarify.
 
Richard Green
Ranch Hand
Posts: 536
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies. I have now changed my display name.
[ June 06, 2006: Message edited by: Lynette Dawson ]
 
Naveen Morrise
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a JSP page where <form id="frmCreateMain" name="frmCreateMain" method="post" action="matchToPreexisting.jsp" target="addrstand"> has call to the database, which is causing the delay in sending a XML response back which is getting parsed on everykey stroke which is time consuming. So, some how I need to get this delay reduced.

Here the scenario works like below:

The front end is the JSP Page that is displayed to the normal user.

Any thing that is displayed on the GUI, that might be either label or the text box or might be any thing is being populated from XML file.

The underneath XSL file is generating the HTML file based on the XML at the GUI.

And my understanding of the code is correct and sure.

So, if some one can help me in giving me the idea why in the GUI it displays characters or numbers after a while. The amount of delay is significant and can be seen even by the normal user. This is the reason only, why I am thinking how to code in such a way that, getting all the elements of the xml document initially when the page first loads (or something like that) and store the elements in CustomerCreate JavaScript data structure. So that, for subsequent access you can access from that data structure rather than invoking the xml parsing api every time .
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're submitting the form on every keystroke?
 
Naveen Morrise
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are right
 
Naveen Morrise
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is coded like that. I am new to the team. But the one who developed did like that.

and I need how to improve the code.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use the onchange event trigger instead of one of the keystroke events, the form won't be submitted until the user leaves the given field.
 
Naveen Morrise
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have onkeyup function right now

fName.attachEvent('onkeyup',initName);

So, do I have to change it or not. Please correct me.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think about when you want the event to be fired.

If you want it to happen with each keystroke and don't mind waiting, leave it as it is. If you don't want it fired until the user is done working with the given field, use the onchange or onblur event triggers instead.
 
Naveen Morrise
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, Can I use

fName.attachEvent('onChange',initName);
or
fName.attachEvent('onBlur',initName);

lines of code for my purpose
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this has become more about client-side code than JSP, I've moved this to the HTML forum.
 
Naveen Morrise
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one help in this regards by looking the above series of forum
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you search Google for Ajax autocomplete and see if that helps give you an idea.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic