Re: [Wicket-user] Javascript: Deletion Link

2007-06-03 Thread James McLaughlin
Hi Johannes,
I haven't used it, but something like below will move you in the right
direction:
(You might need to do something in the decorateScript method to
prevent the onclick from bubbling)


public class ConfirmationLink extends AjaxFallbackLink
{

public ConfirmationLink(String id)
{
super(id);
}

@Override
public void onClick(AjaxRequestTarget target)
{
if(null == target) {
setResponsePage(new AreYouSurePage(getModel()));
}

// else you know javascript works and they really want this

}

@Override
protected IAjaxCallDecorator getAjaxCallDecorator()
{
return new AjaxCallDecorator() {
@Override
public CharSequence decorateScript(CharSequence script)
{
return if(confirm('Are you sure?')) {  + script + };;
}
};
}

}

best,
jim

On 6/3/07, Johannes Schneider [EMAIL PROTECTED] wrote:
 Hi,

 I want to create a link that shall delete an object on click.
 It would be great if there was shown a confirmation dialog (using
 javascript) before the onClick-method is called.

 I have read some suggestions about adding JavaScript to Links but I
 think this is a very basic behaviour that should be added to Wicket itself.

 It would also be great, if this link pointed to a HTML based
 confirmation page if no JavaScript is available...


 Cheers,

 Johannes Schneider
 --
 Johannes Schneider
 Im Lindenwasen 15
 72810 Gomaringen

 Fon +49 7072 9229972
 Fax +49 7072 50
 Mobil +49 178 1364488

 [EMAIL PROTECTED]
 http://www.johannes-schneider.info

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user




-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Javascript: Deletion Link

2007-06-03 Thread Eelco Hillenius
 I have read some suggestions about adding JavaScript to Links but I
 think this is a very basic behaviour that should be added to Wicket itself.

You could create such a component and add it (or propose to add it) to
wicket minis (wicket-stff project).

Eelco

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user