• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Eli Lato
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18302
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eli Lato
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic