That's great sample, thanks so much Jan, I will try that soon!
Jan Kriesten wrote:
>
>
> just add a behavior to the link which ads a javascript 'onclick':
>
> public class JavascriptEventConfirmation
> extends AttributeModifier
> {
> private static final long serialVersionUID = 1L;
>
> public JavascriptEventConfirmation( final String event, final String msg
> )
> {
> super( event, true, new Model( msg ) );
> }
>
> @Override
> protected String newValue( final String currentValue, final String
> replacementValue )
> {
> if( currentValue != null && currentValue.length() != 0 )
> {
> StringBuilder result = new StringBuilder( 256 );
> result.append( "if( confirm('" );
> result.append( escape( replacementValue ) );
> result.append( "') ){" );
> result.append( currentValue );
> result.append( "} else return false;" );
> return (result.toString());
> }
> else
> {
> return ("return confirm('" + escape( replacementValue ) + "')");
> }
> }
>
> private String escape( final String text )
> {
> if( text == null )
> {
> return (null);
> }
>
> return (text.replaceAll( "\"", """ ));
> }
>
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/how-to-add-a-confirm-window-to-a-Link-button--tf4696906.html#a13427749
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]