Hi,
On Thu, Apr 11, 2013 at 10:59 PM, eugenebalt <[email protected]> wrote: > We have an AjaxButton with the following flag, to disable default form > processing (we don't want it to submit the form): > > ajaxButton.setDefaultFormProcessing(false); > > The problem is that we need to attach a JS alert box ("Are you sure? > OK/Cancel") when this button is clicked. If OK is clicked, we go through > with the onSubmit(), otherwise nothing happens. > > I'm seeing that when I do this > > ajaxButton.add( new SimpleAttributeModifier("onclick", "return confirm('Are > you sure you want to delete the selected record(s)?');")); > Doing it this way it will override button's onclick attribute with your own one. You need to use IAjaxCallDecorator instead. The produced JS should look like: onclick="if(confirm('Blah blah') {wicketAjaxPost(...)})" > > nothing happens regardless of OK/Cancel, the onSubmit is never invoked. Is > that because defaultFormProcessing=False? Is there a workaround? Thanks > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/How-to-Add-JS-Modifer-to-a-Non-Form-Processing-AjaxButton-tp4657904.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>
