You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Larry Sherrill <la...@yahoo.com> on 2005/07/19 18:06:29 UTC
Which button did I press
I have a number of rows that I display using Foreach
inside an html table. At the end of each row is a
delete button (a Submit component). Unpon clicking the
button, I will delete the record from the database,
and redisplay the page.
How can I tell which submit button has been clicked?
The value of the Foreach is a WebPayment object which
has a unique id that I can use to uniquely identify
the row (i.e., WebPayment.getId()).
I have tried setting the tag on the Submit component
to ognl:webPayment.id but I dont see any way to
determine which tag is in play inside the Submit
listener method.
I have also tried a Hidden component as well as some
bizzare javascript but have gotten nowhere.
I am sure this is trivial if you know how to do it,
not so trivial if you dont. Any suggestions would be
appreciated.
I am using Tapestry 3.
Thanks,
Larry Sherrill
City and County of Denver
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Which button did I press
Posted by Mark Dillon <md...@gmail.com>.
Create a page property to represent the deleted WebPayment ID and set
it with the selected parameter in conjunction with the tag. The value
of the tag will set the selected parameter:
<span jwcid="@Submit" value="message:someLabel"
selected="ognl:deletedWebPaymentID" tag="ognl:webPayment.id"/>
In your listener, you can then grab your deletedWebPaymentID to
determine which payment to delete. Does this help?
Mark
On 7/19/05, Larry Sherrill <la...@yahoo.com> wrote:
> I have a number of rows that I display using Foreach
> inside an html table. At the end of each row is a
> delete button (a Submit component). Unpon clicking the
> button, I will delete the record from the database,
> and redisplay the page.
>
> How can I tell which submit button has been clicked?
> The value of the Foreach is a WebPayment object which
> has a unique id that I can use to uniquely identify
> the row (i.e., WebPayment.getId()).
>
> I have tried setting the tag on the Submit component
> to ognl:webPayment.id but I don't see any way to
> determine which tag is in play inside the Submit
> listener method.
>
> I have also tried a Hidden component as well as some
> bizzare javascript but have gotten nowhere.
>
> I am sure this is trivial if you know how to do it,
> not so trivial if you don't. Any suggestions would be
> appreciated.
>
> I am using Tapestry 3.
>
> Thanks,
> Larry Sherrill
> City and County of Denver
>
>
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Which button did I press
Posted by Larry Sherrill <la...@yahoo.com>.
It worked! Thanks Danny and Mark. I used Danny's
solution which sets the object rather than the id but
it looks like both solutions work.
--- Danny Mandel <dm...@tolweb.org> wrote:
> Hi Larry. Using the tag is only half the answer. You
> also need to bind
> the selected parameter to tell the submit component
> which property to
> update.
>
> Here's an actual example I have in some code:
>
> <span jwcid="@base:For" source="ognl:media.nodesSet"
> element="ognl:null"
> value="ognl:currentNode" convertor="ognl:convertor">
> <li class="group"><span jwcid="@Insert"
> value="ognl:currentNode.name"/>
> <submit jwcid="@Submit"
> listener="ognl:listeners.removeGroup"
> selected="ognl:nodeToDelete" tag="ognl:currentNode"
> class="remove">Remove</a></li>
> </span>
>
> So, here the selected property is nodeToDelete. In
> my listener method I
> can call getNodeToDelete() and it will have the
> selected node and I can
> go forward with deletion. Like you said, it's easy
> once you know how to
> do it!
>
> Hope that helps,
> Danny
>
> Larry Sherrill wrote:
>
> >I have a number of rows that I display using
> Foreach
> >inside an html table. At the end of each row is a
> >delete button (a Submit component). Unpon clicking
> the
> >button, I will delete the record from the database,
> >and redisplay the page.
> >
> >How can I tell which submit button has been
> clicked?
> >The value of the Foreach is a WebPayment object
> which
> >has a unique id that I can use to uniquely identify
> >the row (i.e., WebPayment.getId()).
> >
> >I have tried setting the tag on the Submit
> component
> >to ognl:webPayment.id but I dont see any way to
> >determine which tag is in play inside the Submit
> >listener method.
> >
> >I have also tried a Hidden component as well as
> some
> >bizzare javascript but have gotten nowhere.
> >
> >I am sure this is trivial if you know how to do it,
> >not so trivial if you dont. Any suggestions would
> be
> >appreciated.
> >
> >I am using Tapestry 3.
> >
> >Thanks,
> >Larry Sherrill
> >City and County of Denver
> >
> >
> >
> >
> >
>
>____________________________________________________
> >Start your day with Yahoo! - make it your home page
>
> >http://www.yahoo.com/r/hs
> >
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
> >
> >
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tapestry-user-help@jakarta.apache.org
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Which button did I press
Posted by Danny Mandel <dm...@tolweb.org>.
Hi Larry. Using the tag is only half the answer. You also need to bind
the selected parameter to tell the submit component which property to
update.
Here's an actual example I have in some code:
<span jwcid="@base:For" source="ognl:media.nodesSet" element="ognl:null"
value="ognl:currentNode" convertor="ognl:convertor">
<li class="group"><span jwcid="@Insert" value="ognl:currentNode.name"/>
<submit jwcid="@Submit" listener="ognl:listeners.removeGroup"
selected="ognl:nodeToDelete" tag="ognl:currentNode"
class="remove">Remove</a></li>
</span>
So, here the selected property is nodeToDelete. In my listener method I
can call getNodeToDelete() and it will have the selected node and I can
go forward with deletion. Like you said, it's easy once you know how to
do it!
Hope that helps,
Danny
Larry Sherrill wrote:
>I have a number of rows that I display using Foreach
>inside an html table. At the end of each row is a
>delete button (a Submit component). Unpon clicking the
>button, I will delete the record from the database,
>and redisplay the page.
>
>How can I tell which submit button has been clicked?
>The value of the Foreach is a WebPayment object which
>has a unique id that I can use to uniquely identify
>the row (i.e., WebPayment.getId()).
>
>I have tried setting the tag on the Submit component
>to ognl:webPayment.id but I don’t see any way to
>determine which tag is in play inside the Submit
>listener method.
>
>I have also tried a Hidden component as well as some
>bizzare javascript but have gotten nowhere.
>
>I am sure this is trivial if you know how to do it,
>not so trivial if you don’t. Any suggestions would be
>appreciated.
>
>I am using Tapestry 3.
>
>Thanks,
>Larry Sherrill
>City and County of Denver
>
>
>
>
>
>____________________________________________________
>Start your day with Yahoo! - make it your home page
>http://www.yahoo.com/r/hs
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org