Thanks a lot! however I don't have wicket.ajax.ClientEvent at wicket 1.2.4 and wicket extension 1.2.4 . May be it locate at other projects?
By the way, I haven't use ajax for that link. Am I have to use ajax to make it work? On 2/2/07, Igor Vaynberg <[EMAIL PROTECTED]> 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]> 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 > > _______________________________________________ > > 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 > > ------------------------------------------------------------------------- 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