This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes How can I make mouseclick on an ice:inputText select all characters? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How can I make mouseclick on an ice:inputText select all characters?" Watch "How can I make mouseclick on an ice:inputText select all characters?" New topic
Author

How can I make mouseclick on an ice:inputText select all characters?

Eli Lato
Greenhorn

Joined: Apr 10, 2011
Posts: 2
When a user tabs to the next ice:inputText field, all characters in the field are selected. So if the user types into the field, its old contents are erased. That's great.

But if a user clicks an ice:inputText, nothing is selected. So the user has to delete the old contents himself. This confuses users.

How can I make a mouseclick on an ice:inputText automatically select all characters in the field?

Thanks,
Eli
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

Welcome to the JavaRanch, Eli!

HTML does this by attaching text-select code to the "focus" JavaScript event. I'm not up to date on the IceFaces input controls, but if they don't automatically do that, you can always supply your own code to do it manually.


Customer surveys are for companies who didn't pay proper attention to begin with.
Eli Lato
Greenhorn

Joined: Apr 10, 2011
Posts: 2
thanks, tim, you're right.

all i needed to do was add onfocus="this.select();"
this works for ie, which is what i need. it doesn't work for ff, but i don't care.
thanks
eli
 
 
subject: How can I make mouseclick on an ice:inputText select all characters?
 
Similar Threads
JSP Invoking another JSP in Iframe
JTable cell is selected but i want the entire row to be selected
how to pass field value in an IFrame to its parent
Distance between a point and a cubic curve
Populate a SelectOneMenu and others