dankass 52 Posted April 18, 2013 Report Share Posted April 18, 2013 Can anyone tell me what the proper syntax would be to pass a text variable as a parameter to a command from the "load html" window... Here's what I've done... This does not work at all.. like you didn't even click the button... <button class=\"buttons delete\" onclick=\"ubot.runScript(\'dosomething(\"{#param}\")\')\">DO SOMETHING</button> This seems to work just fine IF the #param is a numeric value <button class=\"buttons delete\" onclick=\"ubot.runScript(\'dosomething({#param})\')\">DO SOMETHING</button> I also tried the first one with single ' around the {#param} and it did the same as a single quote... SOLVED: As I typed out the above it gave me one last idea to try, I eliminated the {} around the #param (which was put there by the node view) and it worked! It does not show up in nodeview as a highlighted variable but it works now anyway... Quote Link to post Share on other sites
beer BOTtle 0 Posted May 8, 2013 Report Share Posted May 8, 2013 <button class=\"buttons delete\" onclick=\"ubot.runScript(\'dosomething(123)\')\">DO SOMETHING</button> this works, but this not: <button class=\"buttons delete\" onclick=\"ubot.runScript(\'dosomething(TEST)\')\">DO SOMETHING</button> Solution? Quote Link to post Share on other sites
gavind 6 Posted May 9, 2013 Report Share Posted May 9, 2013 Hi DA, this has been for a while now but any news yet if you were able to find a work around on this? Quote Link to post Share on other sites
dankass 52 Posted May 10, 2013 Author Report Share Posted May 10, 2013 Yes, sorry, I do have a solution... here is some example code... I'm only using the on load to set the #param variable to something to demonstrate passing it. I purposfully used a different variable name #test in the define to make it easier to understand and see that its working. so... the variable #param is passed from the button into the dosomething command and read into a new variable called #test. You cannot (for some reason) pass plain text in the parameter, at least not like this, and it has to start off as a variable. on load("Bot Loaded") { set(#param, "Testing", "Global") } ui html panel("<button onclick=\"ubot.runScript(\'dosomething(#param)\')\">DO SOMETHING</button>", 100) define dosomething(#test) { alert(#test) } Hope that helps... now... if I could just figure out how to pass multiple parameters like this I'd be even more happy! 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.