You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Chiappone <ch...@gmail.com> on 2007/04/11 00:39:46 UTC
EventListener questions
Hi I was wondering what the correct way would be to create an
EventListener that returns a confirm when a button is clicked.
I have the following that doesn't work:
@EventListener(elements="deleteButton", events="onclick")
public String testThis(){
return "return confirm('"+ appMess.getString("delete.case") +"')";
}
@Component(id="deleteButton", type="DirectLink", bindings={
"parameters=ognl:currCase", "renderer=bean:buttonRenderer",
"listener=listener:deleteCaseListener",
})
public abstract DirectLink getDeleteButton();
What is the correct way to go about doing something like this?
Thanks
--
~chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: EventListener questions
Posted by Chris Chiappone <ch...@gmail.com>.
Well I tried to do the following:
@Component(id="deleteButton", type="DirectLink", bindings={
"parameters=ognl:currCase", "renderer=bean:buttonRenderer",
"listener=listener:deleteCaseListener",
"onclick=ognl:confirmClick"
})
public abstract DirectLink getDeleteButton();
It seems to work as expected popping up the confirm dialog when
clicked yet the deleteCaseListener always gets triggered even when
cancel is clicked. Which is not what I would expect to happen.
On 4/10/07, Anna Vo <AV...@widen.com> wrote:
> If you are using a DirectLink or a Submit button you do not need to use
> the @EventListener annotation. You can specify using updateComponents
> which elements to refresh. See
> http://tapestry.apache.org/tapestry4.1/components/link/directlink.html
> and http://tapestry.apache.org/tapestry4.1/components/form/submit.html
> for available parameters.
>
> Example:
> <a jwcid="@DirectLink" updateComponents="ognl:{'idOfAreaToUpdate'}"
> listener="listener:someLinkClicked" parameters="ognl:someObject.id"
> async="true">Link </a>
>
> The idOfAreaToUpdate is the id of a component (<div
> jwcid="idOfAreaToUpdate@Any">) and not just the id of a div.
>
> If you use @EventListener, see
> http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html for
> examples and also check out Kent Tong's book:
> http://www.agileskills2.org/EWDT/. Chapter 11 has edit and delete
> examples.
>
> If you want to use javascript, try using scripts. You can include a js
> file and do some dynamic scripting.
> http://tapestry.apache.org/tapestry4.1/components/general/script.html
>
> http://tapestry.apache.org/tapestry4.1/usersguide/script.html
>
> -----Original Message-----
> From: Chris Chiappone [mailto:chiappone@gmail.com]
> Sent: Tuesday, April 10, 2007 5:40 PM
> To: Tapestry List
> Subject: EventListener questions
>
> Hi I was wondering what the correct way would be to create an
> EventListener that returns a confirm when a button is clicked.
>
> I have the following that doesn't work:
>
>
> @EventListener(elements="deleteButton", events="onclick")
> public String testThis(){
>
> return "return confirm('"+
> appMess.getString("delete.case") +"')";
>
> }
>
> @Component(id="deleteButton", type="DirectLink", bindings={
> "parameters=ognl:currCase",
> "renderer=bean:buttonRenderer",
> "listener=listener:deleteCaseListener",
> })
> public abstract DirectLink getDeleteButton();
>
>
> What is the correct way to go about doing something like this?
>
> Thanks
>
> --
> ~chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
~chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: EventListener questions
Posted by Anna Vo <AV...@widen.com>.
If you are using a DirectLink or a Submit button you do not need to use
the @EventListener annotation. You can specify using updateComponents
which elements to refresh. See
http://tapestry.apache.org/tapestry4.1/components/link/directlink.html
and http://tapestry.apache.org/tapestry4.1/components/form/submit.html
for available parameters.
Example:
<a jwcid="@DirectLink" updateComponents="ognl:{'idOfAreaToUpdate'}"
listener="listener:someLinkClicked" parameters="ognl:someObject.id"
async="true">Link </a>
The idOfAreaToUpdate is the id of a component (<div
jwcid="idOfAreaToUpdate@Any">) and not just the id of a div.
If you use @EventListener, see
http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html for
examples and also check out Kent Tong's book:
http://www.agileskills2.org/EWDT/. Chapter 11 has edit and delete
examples.
If you want to use javascript, try using scripts. You can include a js
file and do some dynamic scripting.
http://tapestry.apache.org/tapestry4.1/components/general/script.html
http://tapestry.apache.org/tapestry4.1/usersguide/script.html
-----Original Message-----
From: Chris Chiappone [mailto:chiappone@gmail.com]
Sent: Tuesday, April 10, 2007 5:40 PM
To: Tapestry List
Subject: EventListener questions
Hi I was wondering what the correct way would be to create an
EventListener that returns a confirm when a button is clicked.
I have the following that doesn't work:
@EventListener(elements="deleteButton", events="onclick")
public String testThis(){
return "return confirm('"+
appMess.getString("delete.case") +"')";
}
@Component(id="deleteButton", type="DirectLink", bindings={
"parameters=ognl:currCase",
"renderer=bean:buttonRenderer",
"listener=listener:deleteCaseListener",
})
public abstract DirectLink getDeleteButton();
What is the correct way to go about doing something like this?
Thanks
--
~chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org