Hi Cory,
I don't want to convolute this further, especially if you have something working, but I would put a check in to test whether the code is running on the desktop or live in the Web Client and just use the {} macro in the Web Client.
This is being called from a commandbutton click. I'm passing the txtsearch.text directly. The [] can be used as string delimiters 'in dev' as this is handled by the local Lianja/VFP scripting.
Code:
////////////////////////////////////////////////////////////////
// Event delegate for 'click' event
function page1_section1_field2_click()
{
if (typeof LianjaAppBuilder === 'object')
// in dev
{
var result = Lianja.evaluate('lib_webtest("get_brnum(['+txtsearch.text+'])")');
}
else
// in live web/cloud
{
var result = Lianja.evaluate('lib_webtest("get_brnum(\'{txtsearch.text}\')")');
}
Lianja.writeLog(result);
};
In my original post about passing parameters into the library prg, when I mentioned PCOUNT(), I envisaged passing the parameters in individually to the library, rather than including them as a single parameter.
For example, if this is my procedure library, lib_webtest.prg:
Code:
proc get_brnum
parameters ptext
return ptext + " was passed"
endproc
parameters funcname, para1
do case
case pcount() = 1
return &funcname()
case pcount() = 2
return &funcname(para1)
endcase
I can pass 2 parameters to lib_webtest and it will treat the 2nd as a parameter to the function name in the 1st. Additional parameters can be added and handled with further PCOUNT() cases.
So my button click code becomes:
Code:
////////////////////////////////////////////////////////////////
// Event delegate for 'click' event
function page1_section1_field1_click()
{
if (typeof LianjaAppBuilder === 'object')
{
var result = Lianja.evaluate('lib_webtest("get_brnum","' + txtsearch.text + '")');
}
else
{
var result = Lianja.evaluate('lib_webtest("get_brnum","{txtsearch.text}")');
}
Lianja.writeLog(result);
};
and is probably more readable.
Regards,
Yvonne
Bookmarks