This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Textbox value removal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Textbox value removal" Watch "Textbox value removal" New topic
Author

Textbox value removal

Nipun Bahr
Ranch Hand

Joined: Jul 09, 2008
Posts: 55

Hi All,

I want a textbox value to be erased as soon as user erases some other textbox value?
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Use script to fetch the textfield element. In java script, use document.getElementById("textfield-ID"); or document.form-name.textfield-name.

And



Cheers,
Raj.
Nipun Bahr
Ranch Hand

Joined: Jul 09, 2008
Posts: 55

Hi Raj,

On which event of textbox we need to call this java script?
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


Yes you have to do this using some client side script (eg Javascript).

You could capture the keypress event and check if the value in the first text box has been erased. Then clear the value in the second text box too.

Check the events generated by the textfield HTML element and call the script function for the most suitable one.

Cheers,
Raj.
Nipun Bahr
Ranch Hand

Joined: Jul 09, 2008
Posts: 55


Thanks Raj Its working for me now.

I applied it on onkeyup event of textbox.
 
wood burning stoves
 
subject: Textbox value removal
 
Similar Threads
Problem in integrating Single GWt Textboxs in jsp
NumberFormatException while inserting data into database
Select Object error
how to force setter in jsf??
parse integer value in GWT