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 InputRichText - how to get selected text? 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 "InputRichText - how to get selected text?" Watch "InputRichText - how to get selected text?" New topic
Author

InputRichText - how to get selected text?

Petr Dusek
Greenhorn

Joined: Nov 26, 2012
Posts: 23
I am working with ice:inputRichText. I would like to get the selected text - this relates to the client side, I mean - manipulate it on the server side and put it back to the editor (on the same place, as the selected). Could you advice me please some best practise - how to work with this JSF component?

Thanks a lot.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

JSF is based on the concept of Inversion of Control. In IoC, you don't "get" things, the things are delivered to you.

Thus, if you used the value= attribute to bind a backing bean property to the inputRichText control, the value stored in the client-side text control will automatically be injected into that property when the form that contains it is submitted. The form's action method can then use the data in any way it wishes, including modifying the data so that when the updated form is displayed, the modifications will be sent back to the client.

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

Joined: Nov 26, 2012
Posts: 23
Thank you. That is right, bud what about selected text? I agree - I have got an ice:inputRichText and I will write some text. Then I will select a piece of it and do some action with it. But I have the whole text in value attribute, have not I? Could you show me any example, please?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

I looked at the javadocs and it does not appear that that information is captured.

What you will need to do is add some pre-submit javascript to get the selection information from the CKEditor control and save it in hidden form fields. Then when you process the submitted form, you will have property values that show what you discovered.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: InputRichText - how to get selected text?
 
Similar Threads
Two value to be passed in select
how to reach current JTextArea
Pass radio button/ text box responses from one page to another
getselected
check box