HTML trigger a method in web client

Has anyone figured out a way to trigger a Servoy method with a link in an html_area in web client? Something similar to the following which works in smart client:

<td width="126" align="left"><a href="javascript:REC_row_selected(2,1,null,true)">Cibex Central Corp</a></td>

My brain hit a brick wall on this.

I think what you have to use is the full URL like this one

http://server/servoy-webclient/ss/s/sol … mentString

Hi David,

Your code is right - EXCEPT that you need to single quote the parameters individually:

<a href="javascript:REC_row_selected('2','1','null','true')">Cibex Central Corp</a>

If you just do this:

<a href="javascript:REC_row_selected('2,1,null,true')">Cibex Central Corp</a>

Then you will only get one argument back into your method.

Wow, the reason it wasn’t working for me was because my test case included a string parameter. Smart client is a lot more forgiving in how you format the link with string inputs than web client (web client just sits and looks dumb…servoy 4 should give me debugging feedback…yea!). The following formats work and for the string inputs you HAVE to have the single and double quotes in the EXACT correct order (hope the differences will come through…):

//numeric and null
globals.test2 = '<html><head></head><body><a href="javascript:test(3)">Cibex Central Corp</a></body></html>'

//multiple numerics and/or null
globals.test2 = '<html><head></head><body><a href="javascript:test(3, 45, null)">Cibex Central Corp</a></body></html>'


//string (quote order is extremely important!)
globals.test2 = '<html><head></head><body><a href="javascript:test(' + "'some string'" + ')">Cibex Central Corp</a></body></html>'


//numeric variable
var x = 2
globals.test2 = '<html><head></head><body><a href="javascript:test(' + x + ')">Cibex Central Corp</a></body></html>'

//string variable (quote order is extremely important!)
var x = "some string"
globals.test2 = '<html><head></head><body><a href="javascript:test(' + "'" + x + "'" + ')">Cibex Central Corp</a></body></html>'

I’m very relieved to find that this works right out of the box in web client. Powerful Servoy.