Hi all,
I was wondering if I could combine a call to a Servoy form function and a Javascript client function in 1 link:
(Following code goes into a HTML_AREA)
This code makes a link to a javascript function in the clients browser.
<table>
<tr><td><a href=\"javascript:doClientFunction('-1')\"></td></tr>
</table>
This code makes a link to a servoy form function.
<html><body>
<table>
<tr><td><a href=\"javascript:doServoyFunction('-1')\"></td></tr>
</table>
</body></html>
I’d need to combine both in one link (Is this possible?):
<a href=\"doClientFunction();javascript:doServoyFunction('-1'); \">
I need this to show a loading text in the browser (client javascript call) and after that go to the servoy function.
Hi Jos,
I assume you are doing this in Webclient, because in Smartclient you can’t use JavaScript inside an HTML_AREA field.
Anyway, have you tried to call the javascript:doServoyFunction(‘-1’) from within the doClientFunction ?
How to call a servoy function from within the client javascript?
If I knew how to do it, I would have tried ![Smile :)]()
The only way to call Servoy methods from within javascript in the browser when running the Servoy Web Client is by adding HTML with JavaScript links on your form, for example through a non-editable HTML Area. Servoy will recognize the method calls and will rewrite the call to become a wicket ajax call.
Paul
Yes ok: thats like this:
<html><body>
<table>
<tr><td><a href=\"javascript:doServoyFunction('-1')\"></td></tr>
</table>
</body></html>
But it isn’t possible in code like this: ?
<html>
<script type='text/javascript'>
function clientScript();
{
//set loading text code
.....
//Call servoy function
javascript:doServoyFunction('-1');
}
</script>
</html>
Cause in the link I click, i first want to do some client side functions, before going to servoy.
No, that is not possible, but you could do something along the lines of this:
<html>
<script type='text/javascript'>
function clientScript();
{
//set loading text code
.....
//Call servoy function
document.getElementById('dummy').click();
}
</script>
<input type="button" onclick="javascript:doServoyFunction('-1')" id="dummy"/>
<button onclick="clientSCript()">test</button>
</html>
The dummy input element can be hidden with some custom CSS.
Paul
I’ve used above method successfully. However it’s not clear how to pass a parameter from the calling client side function.
Any suggestions?