setting style from Java code prevents changing from Javascript?

View: New views
3 Messages — Rating Filter:   Alert me  

setting style from Java code prevents changing from Javascript?

by autozoom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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");

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

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

by Dan Labrecque :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

by autozoom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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