This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Automatically populating a Textbox on the basis of the value of another one. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Automatically populating a Textbox on the basis of the value of another one." Watch "Automatically populating a Textbox on the basis of the value of another one." New topic
Author

Automatically populating a Textbox on the basis of the value of another one.

vishnu vyasan
Ranch Hand

Joined: May 27, 2008
Posts: 39
Hi guys,

As the title says how can i populate a textbox based on the value of another in the same form.
is there any other approches apart from using ajax? can we do this in plain JSP?

Best Regards
Vishnu NV
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3670

vishnu vyasan wrote:As the title says how can i populate a textbox based on the value of another in the same form.can we do this in plain JSP?


Ajax use to communicate with the server (may be getting some data from server as well). If you want to populate text box from another textbox's value in the form in the JSP you can use a simple Javascript to do that (with using an event). Is this what you want?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Keerthi Sagar
Greenhorn

Joined: Apr 21, 2007
Posts: 28
vishnu vyasan wrote:Hi guys,

As the title says how can i populate a textbox based on the value of another in the same form.
is there any other approches apart from using ajax? can we do this in plain JSP?

Best Regards
Vishnu NV


Hi Vishnu,
Your wording 'Populating' confusing me. Do you wish to create a new text box or you just want to assign some value to it.

If you want to create a new text box, as Vijitha said, you can use simple Javascript for that using document.createElement() function. Google the net for examples on dynamically creating elements using DOM.

Thanks and Regards,<br />Y. Keerthi Sagar.
vishnu vyasan
Ranch Hand

Joined: May 27, 2008
Posts: 39
I wanted to hit the server and populate the 2nd text box with the value retrieved from DB.

I got the solution by using Ajax.

any way thanks a lot for quick reply
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Automatically populating a Textbox on the basis of the value of another one.
 
Similar Threads
Dropdown
Need Help With Dynamic text box in JSP
retreive the value
How to read the value of a nested tag
can not get the values from textbox