• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Highlight search terms in inputtextarea

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all,

I have one inputtext,commandbutton and inputtextarea.
I want to search the text which is given in inputtext and highlight the same searchtexts in the input textarea.
is there any way to achieve this?

 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't do that in an inputtextarea control, because it's not designed for text formatting. The closest you could come would be to use JavaScript to select the text of interest - which would visually highlight. But I don't think you can select more than one sequence of characters on a web page.

For server-based display-only highlighting you could create a text display zone such as a single-column/single-row panelGrid (or use brute force and an HTML div element), then outputText using the escape-disable feature, inserting highlighting tags.

For highlighting of read/write text, you could use one of the formatted tag extensions such as the RichFaces rich text editor. Although trying to edit highlighted input text can confuse users.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go through http://plugins.jquery.com/project/jCaret

Here is an extract from the pages.



Hope this helps and please note this is purely javascript and nothing to do with JSF

Pradeep
 
Muneeswaran Balasubramanian
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pradeep,

This was very helpful to me.But when i try the above code it found out and highlight the term when it will appear at first time only.I have make some changes and resolve the above problem.But in the code,I can't move the scroll to the highlighted search term.

Is there anyway to achieve this?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic