« Return to Thread: setting style from Java code prevents changing from Javascript?

Re: setting style from Java code prevents changing from Javascript?

by autozoom :: Rate this Message:

Reply to Author | View in Thread

That's very right, thanks a lot

Dan Labrecque wrote:
autozoom wrote:
> Using woodstock components (4.2 b5) and dynamic faces transactions, if I
> change a button's style from Java code like this:
>
> addIndirizzoButton.setImageURL("/resources/images/buttons/aggiungi.gif");
>  

This is not a style property. In fact, this URL value is output as the
src property of an HTML input element.

> then I cannot change it anymore from client-side Javascript code like this:
>
> $(addIndirizzoButtonID).setStyle({'background-image':'url(../resources/images/buttons/aggiungi.disabled.gif)'});
>
> What happens is that code is correctly executed, Firebug tells me that style
> property has changed, but I still see the "old" style in the browser.
> This happens in Firefox, not tested in IE
>  

This is not the correct way to set button properties. Please note that
the public APIs are documented in the TLD docs below. In particular, see
example #5 for the button tag.

    http://webdev2.sun.com/woodstock-tlddocs

To encapsulate brand and functionality changes, you must use the
Woodstock APIs. For example:||

    |<script type="text/javascript">|
    |    var domNode = document.getElementById("form1:button1"); // Get
    button|
    |    domNode.setProps({src: "myImage"});|
    |</script>|

Dan

 « Return to Thread: setting style from Java code prevents changing from Javascript?

LightInTheBox - Buy quality products at wholesale price