How to use ExecuteJavaScript() to get a string value and save to my variable value(string type)?

I used a extra example project [YUI HTML Editor] to get a html string like this:

me.ExecuteJavaScript(" alert( RSCustom.yui.RTE." + YUI2RTE1.ControlID + “.getEditorHTML() );”)

but i need to use “getEditorHTML()” to save this html content string to a dojo string variable? help!

You can’t directly (unless hacking the Xojo Javascript framework).

You will have to create a custom WebControl that encapsulate the [YUI HTML Editor] in order to receive an event allowing you to forward your Javascript value(s) to Xojo variable(s).

Check the WebControlSDK.pdf in the [Extras/WebSDK] folder of your Xojo installation folder.


Technically it could work to assign the result to a textfield and trigger the events in javascript to have the framework send it back to server.

Yes, that what I meant by ‘hacking the Xojo Javascript framework’.
I did it a few years ago:

But at that time there was no WebSDK.

Really, I think the best way today is to create a custom WebControl that encapsulate the Javascript widget, as the Xojo Javascript framework is evolving and the hack may not work from one Xojo versions to the other.


Wait a sec. The yui editor example is already a websdk control. Why not just add your code to that?

Oh, you are right… Should I’ve red the question more carefully.

Then I think what the OP needs is to use the following Xojo Javascript Method:

Xojo.triggerServerEvent(controlID As String, eventName As String, userData As Array)

This will allow to send data back from the browser to the Control Xojo code.