You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vadim Pesochinskiy <vp...@yahoo.com> on 2005/06/22 22:21:18 UTC
Javascript onclick
Hello!
Our web designer has a habit of creating buttons using <a> tag and onclick Javascript and styles for button image. I am wondering how do I do this with Tapestry, without putting Javascript in Tapestry files? Maybe there is a component that can do this type of thing?
Below is fragment of my JSP page (using Struts). Also <a> tag has style id, which I need to preserve, but it looks like Tapestry will remove it. Thanks a lot!
<html:form action="UpdateTicketDescriptionAction" styleId="descEdit">
<!-- WARNING: whitespace chars are not ignored in the textarea, i.e. this tag should be on one line -->
<textarea name="newTicketDescription" id="descEditFld" cols="90" rows="3" ><c:out value="${troubleTicket.ticketDescription}" /></textarea><!-- Save Description text area -->
<a href="javascript:;" onclick="document.getElementById('descEdit').submit(); return false" class="GrcBtn TTAreaBtn" id="descSubmitBtn">
<span class="Ctr"><bean:message key="trouble_ticket.save_description_button" /></span>
<span class="Rt"></span>
</a><!-- Save Description button -->
</html:form>
Regards,
Vadim.
Vadim Pesochinskiy
vpesochi@yahoo.com
---------------------------------
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
Re: Javascript onclick
Posted by Andreas Andreou <an...@di.uoa.gr>.
Vadim Pesochinskiy wrote:
>Hello!
>
>Our web designer has a habit of creating buttons using <a> tag and onclick Javascript and styles for button image. I am wondering how do I do this with Tapestry, without putting Javascript in Tapestry files? Maybe there is a component that can do this type of thing?
>
>
You'll have to create your own component, and make it output whatever
you want.
Then, you'll have to instruct your designer how to use it.
In the example you present, you could end up with something like:
<a jwcid="@MyLink"
onclick="document.getElementById('descEdit').submit(); return false"
class="GrcBtn TTAreaBtn" id="descSubmitBtn"
key="trouble_ticket.save_description_button"
msgClass="Ctr" otherClass="Rt">body ignored</a>
If you also pick good default values, you can further trim down the
above code.
>Below is fragment of my JSP page (using Struts). Also <a> tag has style id, which I need to preserve, but it looks like Tapestry will remove it.
>
Don't think so.
Which tapestry component are you talking about?
And which tapestry version?
> Thanks a lot!
>
> <html:form action="UpdateTicketDescriptionAction" styleId="descEdit">
> <!-- WARNING: whitespace chars are not ignored in the textarea, i.e. this tag should be on one line -->
> <textarea name="newTicketDescription" id="descEditFld" cols="90" rows="3" ><c:out value="${troubleTicket.ticketDescription}" /></textarea><!-- Save Description text area -->
> <a href="javascript:;" onclick="document.getElementById('descEdit').submit(); return false" class="GrcBtn TTAreaBtn" id="descSubmitBtn">
> <span class="Ctr"><bean:message key="trouble_ticket.save_description_button" /></span>
> <span class="Rt"></span>
> </a><!-- Save Description button -->
> </html:form>
>
>
>Regards,
>
>Vadim.
>
>
>Vadim Pesochinskiy
>
>vpesochi@yahoo.com
>
>---------------------------------
>Yahoo! Sports
> Rekindle the Rivalries. Sign up for Fantasy Football
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org