[Wicket-user] Problem of adding confirm javascript to link
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=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem of adding confirm javascript to link
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 IModelString message; public JavascriptConfirm(final ClientEvent event, final IModelString 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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem of adding confirm javascript to link
-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 IModelString message; public JavascriptConfirm(final ClientEvent event, final IModelString 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=lnkkid=120709bid=263057dat=121642 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem of adding confirm javascript to link
yes, but that will eat any other javascript in the event. -igor 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 IModelString message; public JavascriptConfirm(final ClientEvent event, final IModelString 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=lnkkid=120709bid=263057dat=121642 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem of adding confirm javascript to link
replace ClientEvent with a string then and pass in onclick or something. -igor On 2/2/07, Carfield Yim [EMAIL PROTECTED] wrote: 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 IModelString message; public JavascriptConfirm(final ClientEvent event, final IModelString 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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem of adding confirm javascript to link
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 IModelString message; public JavascriptConfirm(final ClientEvent event, final IModelString 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=lnkkid=120709bid=263057dat=121642 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=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=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user