This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes getting data in two text boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "getting data in two text boxes" Watch "getting data in two text boxes" New topic

getting data in two text boxes

sonali duggi

Joined: Oct 09, 2009
Posts: 8
i am using struts tags to display data in jsp.. my question is i was created two text fields name and name1.
if i type name in name field the name should come in name 1 field simultaniously..

some one please reply me

thanking you
Ankit Garg

Joined: Aug 03, 2008
Posts: 9403

How is this related to struts?? This seems a simple javascript problem to me. You need to trace the keypress event of the first textbox and copy the text of the first text box into the second one using DOM manipulation. Look at this (I'm using struts 2 tag as you didn't mention which version of struts are you using)

You can also use the disabled attribute on the second textbox if you don't want the user to be able to edit the value of the second text box but remember that then its value won't be submitted to the server...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
sonali duggi

Joined: Oct 09, 2009
Posts: 8
hello Ankit Garg

thanks for your reply.. it's really good and simple..
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: getting data in two text boxes
It's not a secret anymore!