Re: SubmitLink with confirmation dialog

2011-05-01 Thread scorpio2002
Dear Martin,
thank you for answering. I tried something like this:

--
SubmitLink link = new SubmitLink(link) {
public void onSubmit() { /* my stuff */}
}

link.add(new SimpleAttributeModifier(onclick, return confirm('are you
sure?');));
--

However, weather I click 'Cancel' or 'OK', the code in the onSubmit() method
never gets executed.

I'm stuck, I can't believe such a framework does not support this basic
feature O_o I must be missing something obvious ^^
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/SubmitLink-with-confirmation-dialog-tp3487505p3488329.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: SubmitLink with confirmation dialog

2011-05-01 Thread Pedro Santos
Hi, SubmitLink already write some JavaScript in the onclick handler, so you
need to prepend the confirmation JavaScript in order to maintain the default
behavior. e.g.

submitLink.add(new Behavior() {
onComponentTag() {
tag.put(onclick, if(!confirm('c')) return false; +
tag.getAttribute(onclick));
}
});

In Wicket 1.5 RC4 you can also use the AttributeAppender to prepend the
confirmation JavaScript.

On Sun, May 1, 2011 at 4:03 PM, scorpio2002 d.capite...@gmail.com wrote:

 Dear Martin,
 thank you for answering. I tried something like this:

 --
 SubmitLink link = new SubmitLink(link) {
public void onSubmit() { /* my stuff */}
 }

 link.add(new SimpleAttributeModifier(onclick, return confirm('are you
 sure?');));
 --

 However, weather I click 'Cancel' or 'OK', the code in the onSubmit()
 method
 never gets executed.

 I'm stuck, I can't believe such a framework does not support this basic
 feature O_o I must be missing something obvious ^^
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/SubmitLink-with-confirmation-dialog-tp3487505p3488329.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Pedro Henrique Oliveira dos Santos