Re: Getting Javascript function return value in Wicket
You can create AbstractDefaultAjaxBehavior create JS function of it And call it from JS code Then get result in response On Fri, 20 Mar 2020 at 08:34, Arunachalam Sibisakkaravarthi wrote: > > Hi guys, > I want to execute js and get output in Wicket, so that it can be used in > other places where I want. > Is it possible in Wicket? > > > > *Thanks And RegardsSibi.ArunachalammCruncher* -- WBR Maxim aka solomax - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Getting Javascript function return value in Wicket
Just want to add that the call to the class which would encapsulate the code to call the javascript function and get the result would not be in the constructor, rather in the onclick() of a button or the applyState() of the wizard. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-Javascript-function-return-value-in-Wicket-tp3327794p3329641.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: Getting Javascript function return value in Wicket
Maybe this wiki entry is helpful: Generate a JS within Wicket: https://cwiki.apache.org/WICKET/adding-javascript-from-wicket.html the other way round: https://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html HTH Am 28.02.2011 um 12:34 schrieb drf: Does anyone have any simple and clear examples as to how to call a javascript function within Wicket AND to then retrieve the output of the function? I see a few people trying to do the same thing but cannot find and clear examples. Any help is truly appreciated! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-Javascript-function-return-value-in-Wicket-tp3327794p3327794.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: Getting Javascript function return value in Wicket
Thanks, but what we are looking for is a fully working example of how to call a javascript function and retrieve the return value on the Java side. The examples provided are not full or clear to any of us. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-Javascript-function-return-value-in-Wicket-tp3327794p3327906.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: Getting Javascript function return value in Wicket
See http://code.google.com/p/londonwicket/downloads/list LondonWicket-Paint On Mon, Feb 28, 2011 at 3:24 PM, drf davidrfi...@gmail.com wrote: Thanks, but what we are looking for is a fully working example of how to call a javascript function and retrieve the return value on the Java side. The examples provided are not full or clear to any of us. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-Javascript-function-return-value-in-Wicket-tp3327794p3327906.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: Getting Javascript function return value in Wicket
Looked at the pdf - but there is no documentation or text and cannot see how the code addresses the problem of how to retrieve the return value from a javascript function within Wicket. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-Javascript-function-return-value-in-Wicket-tp3327794p3327979.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: Getting Javascript function return value in Wicket
Look at the .zip, there is code inside. The javascript sends events to java with the current position of the mouse. On Mon, Feb 28, 2011 at 4:19 PM, drf davidrfi...@gmail.com wrote: Looked at the pdf - but there is no documentation or text and cannot see how the code addresses the problem of how to retrieve the return value from a javascript function within Wicket. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-Javascript-function-return-value-in-Wicket-tp3327794p3327979.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: Getting Javascript function return value in Wicket
Thanks a lot, but there are no comments or notes in the code and we cannot see how to apply the example provided to our use case. Let's say we create a class like this (notes are my understanding of what each method is doing): public class JSTest extends AbstractDefaultAjaxBehavior { // Used to add Javacript to page @Override public void renderHead(IHeaderResponse response) { response.renderOnDomReadyJavascript( function test() {return 'abcd' };); } // Used to call javascript and then return result @Override public final CharSequence getCallbackUrl(final boolean onlyTargetActivePage) { return super.getCallbackUrl(onlyTargetActivePage) + x='test()'; } // Used to get return value from request @Override protected void respond(AjaxRequestTarget target) { Request request = RequestCycle.get().getRequest(); String x = request.getParameter(x); System.out.println(value:+x); } } How would we then instantiate and call this class ??? Adding this in the constructor: add( new JSTest()) Does nothing - would expect the print statement in respond() to be called. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-Javascript-function-return-value-in-Wicket-tp3327794p3329321.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