Is there a way to call a Servoy method from HTML and pass some variable data?
So far, I have only been able to call methods with literals for arguments like: javascript:globals.xyz(1).
I would like to do something like this: javascript:globals.xyz3(document.getElementById(‘myElement’).value) but Servoy doesn’t recognize that.
Hi Patrick, I know how to do it with the BrowserSuite, unfortunately, I’m talking about the webclient here.
So the webclient should be aware of the DOM but I guess it never gets a change, I think Servoy tries to translate the whole onclick event code into a method call.
That’s why I think Servoy parsed the whole string beforehand. It is passed back by the wicketAjaxGet for Servoy to evaluate while I wanted the client to evaluate part of it. Seems to be all or nothing. If I change the globals.xyz3() for alert() it displays exactly what I want to pass to Servoy so I am dealing with the proper id as long as Servoy would leave it be.
Actually, you should have a look at the WebClientUtils, that could help invoking client side javascript and/or evaluating it on the client before calling back Servoy.
We opened a project for Sean Devlin from Servoy on ServoyForge, as soon as he will have filled the repository and files section we will set the project as public and you will have access to this, I think it could solve your problem.
This is currently not possible, the only way to do this is client-side (so in the browser) retrieving the string value of the onclick handler and start parsing away yourself, replacing the arguments for the method you’re calling. quite cumbersome.
Please file a feature request to see if we can make this easier.
So callback would be your Servoy method. I specifically don’t supply any parameters here.
Servoy will translate this call into a wicket call that will supply the arguments to your Servoy method.
Here’s my need:
– I want to call a Servoy method from client-side JavaScript based on a non-Servoy, Java-applet-generated event.
– I’d like to pass binary data and not just strings or other primitives.
As far as I can tell, Sean’s web client utils allow a call from server to client, and then a callback with a result. That works great. However, as noted above, my event is initiated from the server side, but rather purely from the client-side.
I can call a Servoy method with no parameters, but trying to duplicate Jeroen’s technique is fighting me.