Re: How to call a Wicket Ajax click event

2012-12-06 Thread Martin Grigorov
Hi,

Wicket 6 uses jQuery.on() to register the event listeners.
If your AjaxSubmitLink listens on 'click' then
jQuery('#theSubmitLinkId').triggerHandler('click') should do it.
Also check the docs of jQuery#trigger


On Thu, Dec 6, 2012 at 1:53 AM, Jered Myers jer...@maplewoodsoftware.comwrote:

 The link here is actually an AjaxSubmitLink and not an AjaxLink.  I am
 trying to get back to the onSubmit on the server side.  I saw
 http://apache-wicket.1842946.**n4.nabble.com/Wicket-6-Ajax-**
 Behaviors-td4654398.htmlhttp://apache-wicket.1842946.n4.nabble.com/Wicket-6-Ajax-Behaviors-td4654398.html,
 but $(mylink).triggerHandler('**click') doesn't seem to be working. Do I
 treat the trigger on an AjaxSubmitLink different from a regular AjaxLink?


 On 12/05/2012 03:28 PM, Jered Myers wrote:

 Wicket 6.3

 How do I call a click event on an AjaxLink from via jQuery or JavaScript?
  I have an AjaxLink that I have added to the page and after I run some
 JavaScript, I want to pragmatically click the link with JavaScript.  This
 broke when updating from Wicket 1.5 to 6.  It appears that the onclick
 attribute is no longer on my link and I am not sure how to call the events
 that Wicket has registered in the head.





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


Re: How to call a Wicket Ajax click event

2012-12-06 Thread Jered Myers
I am able to make this work in a Quickstart, so there must be something 
else wrong.  Thanks for the response Martin.


Here is code if anybody wants an example:
Java:
AjaxLinkVoid standardAjaxLink = new 
AjaxLinkVoid(standardAjaxLink)

{
private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target)
{
target.appendJavaScript(alert('The standard ajax link 
has been clicked'););

}
};
standardAjaxLink.setOutputMarkupId(true);
add(standardAjaxLink);

FormVoid form = new FormVoid(pageForm);
add(form);

AjaxSubmitLink ajaxSubmitLink = new 
AjaxSubmitLink(ajaxSubmitLink)

{
private static final long serialVersionUID = 1L;

@Override
public void onSubmit(AjaxRequestTarget target, Form? form)
{
target.appendJavaScript(alert('The ajax submit link 
has been subimtted'););

}
};
form.add(ajaxSubmitLink);

HTML:
script
function clickTheAjaxLink() {
$(a[linkType=standard]).triggerHandler(click);
}
function clickTheAjaxSubmitLink() {
$(a[linkType=submit]).triggerHandler(click);
}
/script
a href=# onclick=clickTheAjaxLink();Click the Ajax 
Link/a a wicket:id=standardAjaxLink linktype=standardStandard 
Ajax Link/a

br /br /
a href=# onclick=clickTheAjaxSubmitLink();Click the 
Ajax Submit Link/a

form wicket:id=pageForm
input type=text value=Some Data/input
a wicket:id=ajaxSubmitLink linktype=submitSubmit 
Form/a

/form

On 12/06/2012 12:16 AM, Martin Grigorov wrote:

Hi,

Wicket 6 uses jQuery.on() to register the event listeners.
If your AjaxSubmitLink listens on 'click' then
jQuery('#theSubmitLinkId').triggerHandler('click') should do it.
Also check the docs of jQuery#trigger


On Thu, Dec 6, 2012 at 1:53 AM, Jered Myers jer...@maplewoodsoftware.comwrote:


The link here is actually an AjaxSubmitLink and not an AjaxLink.  I am
trying to get back to the onSubmit on the server side.  I saw
http://apache-wicket.1842946.**n4.nabble.com/Wicket-6-Ajax-**
Behaviors-td4654398.htmlhttp://apache-wicket.1842946.n4.nabble.com/Wicket-6-Ajax-Behaviors-td4654398.html,
but $(mylink).triggerHandler('**click') doesn't seem to be working. Do I
treat the trigger on an AjaxSubmitLink different from a regular AjaxLink?


On 12/05/2012 03:28 PM, Jered Myers wrote:


Wicket 6.3

How do I call a click event on an AjaxLink from via jQuery or JavaScript?
  I have an AjaxLink that I have added to the page and after I run some
JavaScript, I want to pragmatically click the link with JavaScript.  This
broke when updating from Wicket 1.5 to 6.  It appears that the onclick
attribute is no longer on my link and I am not sure how to call the events
that Wicket has registered in the head.







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



How to call a Wicket Ajax click event

2012-12-05 Thread Jered Myers

Wicket 6.3

How do I call a click event on an AjaxLink from via jQuery or 
JavaScript?  I have an AjaxLink that I have added to the page and after 
I run some JavaScript, I want to pragmatically click the link with 
JavaScript.  This broke when updating from Wicket 1.5 to 6.  It appears 
that the onclick attribute is no longer on my link and I am not sure how 
to call the events that Wicket has registered in the head.


--
Jered Myers


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



Re: How to call a Wicket Ajax click event

2012-12-05 Thread Jered Myers
The link here is actually an AjaxSubmitLink and not an AjaxLink.  I am 
trying to get back to the onSubmit on the server side.  I saw 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-Ajax-Behaviors-td4654398.html, 
but $(mylink).triggerHandler('click') doesn't seem to be working. Do I 
treat the trigger on an AjaxSubmitLink different from a regular AjaxLink?


On 12/05/2012 03:28 PM, Jered Myers wrote:

Wicket 6.3

How do I call a click event on an AjaxLink from via jQuery or 
JavaScript?  I have an AjaxLink that I have added to the page and 
after I run some JavaScript, I want to pragmatically click the link 
with JavaScript.  This broke when updating from Wicket 1.5 to 6.  It 
appears that the onclick attribute is no longer on my link and I am 
not sure how to call the events that Wicket has registered in the head.