Forums Register Login

Javascript getElementById equivalent in JSF ????

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
Thanks, i hope JSF 1.2 arrives soon.
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3584 times.
Similar Threads
Supplying value to innerHTML
Transparent PNGs as backgrounds in IE
Set method not being called in subview
Please Help : Problem getting submitted value for dynamic input text field
valueChangeListener
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:42:34.