View Full Version : how to get value without submitting a page

10-17-2005, 04:54 AM

I have a form that has many fields (textbox/listbox). when user enter/change a value in the first textbox, I need to pass this value to the database to check whether it exist and get the other values to be displayed to other fields in that form (i cannot get the javascript value to be pass to jsp without reload/refresh/submit. But, I need to get the user entered value, so I thought of hidden popup, iframe, ajax, etc but not sure how I could apply and which best suit this case). If I submit the page then I can easily get the value thru 'request.getParameter("fieldname") but cannot use this because I cannot submit the page.

Pls help and possible provide me with the sample coding


10-17-2005, 06:09 AM
What you are looking for is called AJAX (Asynchronous Javascript and XML). Implementing it yourself is not fun (works differently in most major browsers), but luckily there are plenty of good libraries out there.

The one I use is called Prototype. While it doesn't come with any documentation, I did find a good page with code examples here (http://www.sergiopereira.com/articles/prototype.js.html).

You can get Prototype here (http://prototype.conio.net/).

edit:scroll down to the bit with 'The Ajax object' as the heading.