HTML AREA Parsing

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

HTML AREA Parsing

Postby Janssenjos » Thu Jun 10, 2010 1:15 pm

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.
Code: Select all
<table>
<tr><td><a href=\"javascript:doClientFunction('-1')\"></td></tr>
</table>


This code makes a link to a servoy form function.
Code: Select all
<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?):
Code: Select all
<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.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: HTML AREA Parsing

Postby ROCLASI » Thu Jun 10, 2010 2:24 pm

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 ?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: HTML AREA Parsing

Postby Janssenjos » Fri Jun 11, 2010 9:11 am

How to call a servoy function from within the client javascript?

If I knew how to do it, I would have tried :)
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: HTML AREA Parsing

Postby pbakker » Fri Jun 11, 2010 9:34 am

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
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: HTML AREA Parsing

Postby Janssenjos » Fri Jun 11, 2010 10:05 am

Yes ok: thats like this:

Code: Select all
<html><body>
<table>
<tr><td><a href=\"javascript:doServoyFunction('-1')\"></td></tr>
</table>
</body></html>


But it isn't possible in code like this: ?
Code: Select all
<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.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: HTML AREA Parsing

Postby pbakker » Fri Jun 11, 2010 10:18 am

No, that is not possible, but you could do something along the lines of this:
Code: Select all
<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
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: HTML AREA Parsing

Postby sergei.sheinin » Thu Jun 19, 2014 12:53 pm

I've used above method successfully. However it's not clear how to pass a parameter from the calling client side function.

Any suggestions?
Sergei Sheinin
JavaScript, RDBMS
http://js2dx.com
sergei.sheinin
 
Posts: 79
Joined: Wed May 07, 2014 3:22 pm

Re: HTML AREA Parsing

Postby pbakker » Thu Jun 19, 2014 12:58 pm

pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: HTML AREA Parsing

Postby sergei.sheinin » Thu Jun 19, 2014 2:09 pm

That was easy.
Sergei Sheinin
JavaScript, RDBMS
http://js2dx.com
sergei.sheinin
 
Posts: 79
Joined: Wed May 07, 2014 3:22 pm


Return to Web Development

Who is online

Users browsing this forum: No registered users and 3 guests

cron