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 <[EMAIL PROTECTED]> 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="[EMAIL PROTECTED]">) 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:[EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
~chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]