Em Thu, 22 Jan 2009 22:12:03 -0300, James Sherwood <jsherw...@rgisolutions.com> escreveu:

Thank you,

:)

However I believe I have solved it and can still just use form fragments.

Below is my class which basically just keeps the checkbox hidden and fires the click from the button(I believe the reason only a checkbox or radio is used is because the element itself keeps track of the state, if it was a
button they javascript would have to keep track of it).

Very nice! You could even contribute it to the Tapestry components collection!

QUESTION: "onclick", "document.getElementById('" + getClientId() +
"').click()"); Is not proper at all I believe. Does anyone know how to do this properly with tapestry? Would just have to figure out a way to fire
the observe function with the clientid maybe?

AFAIK this is much more of a Javascript issue than a Tapestry one. We should then use Prototype's event handling.

You could use something like this (not tested):

Component class:

@Inject
private RenderSupport renderSupport;

@BeginRender
void begin(MarkupWriter writer) {

    ... render HTML without any onclick attributes

    // Add a Javascript code line that will bind the click event of your
    // button to function
String javascript = "Event.observe($(%s), 'click', this.simplify.bindAsEventListener(this));"; renderSupport.addScript(String.format(javascript, element.getClientId(), message));

}

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to