you can use an early exit instead

if (!confirm('foo')) return;

-igor


On Tue, Feb 26, 2008 at 9:20 AM, Martin Grigorov
<[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I want to decorate AjaxLink with custom JavaScript:
>
>         @Override
>         protected IAjaxCallDecorator getAjaxCallDecorator() {
>                 return new AjaxCallDecorator() {
>                         @Override
>                         public CharSequence decorateScript(final CharSequence 
> script) {
>                                 return "if (confirm('Are you sure?')) {" + 
> script + " } ";
>                         }
>                 };
>         }
>
>  But Ajax(Fallback)Link has a AjaxEventBehavior("onclick") that decorates
>  my AjaxCallDecorator with CancelEventIfNoAjaxDecorator...
>
>  So the final result is something like:
>  <a id="deleteSynonymExpressionLink11" onclick="if (confirm('Are you
>  sure?')) {var
>  
> wcall=wicketAjaxGet('../?wicket:interface=:0:synonymsForm:deleteSynonymExpressionLink::IBehaviorListener:0:1',null,null,
>  function() {return Wicket.$('deleteSynonymExpressionLink11') != 
> null;}.bind(this)); } return !wcall;" 
> href="../?wicket:interface=:0:synonymsForm:deleteSynonymExpressionLink::ILinkListener::">Delete</a>
>
>
>  The problem is in " return !wcall" that is appended at the end by
>  CancelEventIfNoAjaxDecorator.postDecorateScript()
>
>  What is the best way to do such kind of functionality ?
>
>
>  Regards
>  Martin
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to