for ajax links you need to use an IAjaxCallDecorator to tweak the
javascript. below is a possible impl.

-igor

public class JavascriptConfirmDecorator extends AjaxCallDecorator
{
        private final String confirmMessage;
        
        public JavascriptConfirmDecorator(String confirmMessage)        {
                this.confirmMessage = confirmMessage;
        }
        
        @Override
        public CharSequence decorateScript(Component c, CharSequence script)    
{
                        return "if (!confirm('" + 
StringUtils.replace(confirmMessage, "'",
"\'") + "')) return false;\n" + script;
        }
}

On Mon, Jan 23, 2012 at 3:53 PM, chimaira <death_style2...@hotmail.com> wrote:
> Hello , sorry for my english !
>
>
> I m facing a probleme with AjaxSubmitLink on a form compoenent
>
> I want to add a simple attribute modifier with a on click and a confirm
> javascript popup, to get to user confirmation befor submiting.
>
> That works fine with a simple wicket button , but I want to use
> AjaxSubmitLink that way I can overrid the OnError methode and refresh my
> form feedback, so I create I class AjaxConfirmButton extends AjaxSubmitLink.
> and in the constructor I add the behaviour (add( new
> SimpleAttributeModifier('onclick', "return confirm(...)").
>
> the probleme is the on click javascript is never calld and the form is never
> submited.
>
> is there a way to fix this issue?
>  hanks a lot
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-Simple-attribute-modifier-confirm-javascript-popup-never-calld-form-not-submited-tp4322492p4322492.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
>

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

Reply via email to