Re: How to Add JS Modifer to a Non-Form-Processing AjaxButton

2013-04-15 Thread eugenebalt
Hi, I overrode the IAjaxCallDecorator as below, but it still doesn't work:
there is no action when I click OK (although the popup appears). Do I need
to add something else? Thanks,

linkDelete = new AjaxButton(linkDelete) { 

@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new AjaxCallDecorator() 
{

private static final long 
serialVersionUID = 1L;

@Override
public CharSequence 
decorateScript(CharSequence script) {
// TODO Auto-generated method 
stub
return 
super.decorateScript(return confirm('Are you sure you want to
delete the selected record(s)?');  + script);
}

};
}

@Override
protected void onSubmit(AjaxRequestTarget target, 
Form? arg1) {
  //  submit logic ...
  }

My HTML:

button type=button class=dlt wicket:id=linkDelete images/1c.png
Delete/button



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-Add-JS-Modifer-to-a-Non-Form-Processing-AjaxButton-tp4657904p4657991.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



Re: How to Add JS Modifer to a Non-Form-Processing AjaxButton

2013-04-15 Thread eugenebalt
Never mind, I got it work. What I had to do was this:

public CharSequence decorateScript(CharSequence script) {
// TODO Auto-generated method 
stub
return 
super.decorateScript(var x = confirm('Are you sure you want to
delete the selected record(s)?'); if(x) {  + script +  }  );

Thanks
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-Add-JS-Modifer-to-a-Non-Form-Processing-AjaxButton-tp4657904p4657992.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



Re: How to Add JS Modifer to a Non-Form-Processing AjaxButton

2013-04-12 Thread Martin Grigorov
Hi,


On Thu, Apr 11, 2013 at 10:59 PM, eugenebalt eugeneb...@yahoo.com 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


How to Add JS Modifer to a Non-Form-Processing AjaxButton

2013-04-11 Thread eugenebalt
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)?');));

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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



How to Add JS Modifer to a Non-Form-Processing AjaxButton

2013-04-11 Thread eugenebalt
There was some error submitting the first post, so I'll resubmit:

We have an AjaxButton on which defaultFormProcessing = FALSE. I need to
attach a JS modifier to it with an alert box (Are you sure? OK/Cancel),
but when I add a SimpleAttributeModifier, I don't go through with the
onClick regardless of OK/Cancel, there is no action.

I was wondering if that was because of the defaultFormProcessing = FALSE.
Thanks



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-Add-JS-Modifer-to-a-Non-Form-Processing-AjaxButton-tp4657905.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