• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Javascript getElementById equivalent in JSF ????

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I was wondering if i can access the properties of a regular html element from a JSF bean. What i want is to change the value of a DIV's css class property from a managed bean.

ej:

<div id="thisDiv" class="normal">
<t:inputText id="user" binding="#{bean.user}" required="true" />
</div>

So, during submit, if the inputText reports an error, i want to change
the DIV's class to "error" (for example), so that it would but a border or
do something around the inputText.
I know I could put something like
<div id="thisDiv" class="<t: outputText value="#{bean.user.isValid ? 'normal': 'error'}" />">
but i want to do it dinamically


Thanks a lot
[ March 29, 2006: Message edited by: Patricio Hervas ]
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If using <div> is important for you:
You will be able to do so in the comming JSF 1.2.
Currently, you can use JSF1.1+Facelets to reach the same right now.
Most likely you might be able to have it using JSP 2.0 EL . I.e. ${} syntax.

If you just want to have the same look-n-feel, you can use something like this:

<h: panelGroup style="display:block" id="likeThisDiv" class="#{bean.user.isValid ? 'normal': 'error'}">
....
</h: panelGroup>

--
Sergey : http://jsfTutorials.net
[ March 29, 2006: Message edited by: Sergey Smirnov ]
 
Patricio Hervas
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, i hope JSF 1.2 arrives soon.
reply
    Bookmark Topic Watch Topic
  • New Topic