Sorry, look like Link.getOnClickScript() is actually work, just I only call 'confirm xxx' but not ' return confrm xxx'
On 2/2/07, Justin Lee <[EMAIL PROTECTED]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: RIPEMD160 > > More simply, you could do this: > > add(new AttributeModifier("onClick", true, > new Model("javascript:return confirm('Are you sure you want to delete > this?');"))); > > Igor Vaynberg wrote: > > package wicket.misc; > > > > import wicket.Component; > > import wicket.ajax.ClientEvent; > > import wicket.behavior.AbstractBehavior; > > import wicket.markup.ComponentTag; > > import wicket.model.IModel; > > > > public class JavascriptConfirm extends AbstractBehavior { > > > > private final ClientEvent event; > > > > private final IModel<String> message; > > > > public JavascriptConfirm(final ClientEvent event, final > > IModel<String> message) { > > super(); > > this.event = event; > > this.message = message; > > } > > > > public void onComponentTag(Component component, ComponentTag tag) { > > StringBuilder handler = new StringBuilder(128); > > handler.append("if (!confirm('"); > > handler.append(message.getObject()); > > handler.append("')) {return false;} "); > > > > String script = tag.getAttributes().getString( event.getEvent()); > > if (script != null) { > > handler.append(script); > > } > > > > tag.put(event.getEvent(), handler.toString()); > > } > > > > @Override > > public void detach(Component component) { > > super.detach(component); > > message.detach(); > > } > > } > > > > -igor > > > > > > On 2/2/07, *Carfield Yim* < [EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED]>> wrote: > > > > For some delete link, I've add a confirm() javascript for > > Link.getOnClickScript() . However I found that even I click cancel at > > the javascript popup wicket will still execute the link. (delete the > > record in my case) > > > > How can I press the cancel message to wicket? > > > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, > > security? > > Get stuff done quickly with pre-integrated technology to make your > > job easier. > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642> > > _______________________________________________ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > <mailto:Wicket-user@lists.sourceforge.net> > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > ------------------------------------------------------------------------ > > > > ------------------------------------------------------------------------- > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with pre-integrated technology to make your job > > easier. > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > - -- > Justin Lee > http://www.antwerkz.com > AIM : evan chooly > Skype : evanchooly > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2.1 (Cygwin) > > iD8DBQFFw1DxJnQfEGuJ90MRA354AJ4/9yW2G9jqCsBoA49/TceCy5/0oACbBiyz > wutmcOpbx+Q/sD5Kx0wSK2E= > =hDch > -----END PGP SIGNATURE----- > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user