I have an idea - Load javascript array into textarea(1row=1item) and then show it.
in button1:
dim jscript as string
dim i as integer
jscript="var items=ganttChartView.items;"
for i = 0 to 10
jscript = jscript +"document.getElementById('" + Textarea1.controlID + "_inner').value += items["+str(i)+"].content + ""\
"";"
next
me.ExecuteJavaScript(jscript)
Now items are in textarea(I see them), but when I try in button2:
dim a as String
a=TextArea1.Text
msgbox a
-> It show nothing(""). But when I manually write “a” into textarea with items and then button2, so it show…
[quote=167128:@Krystof Jurecka]I have an idea - Load javascript array into textarea(1row=1item) and then show it.
in button1:
dim jscript as string
dim i as integer
jscript="var items=ganttChartView.items;"
for i = 0 to 10
jscript = jscript +"document.getElementById('" + Textarea1.controlID + "_inner').value += items["+str(i)+"].content + ""\
"";"
next
me.ExecuteJavaScript(jscript)
Now items are in textarea(I see them), but when I try in button2:
dim a as String
a=TextArea1.Text
msgbox a
-> It show nothing(""). But when I manually write “a” into textarea with items and then button2, so it show…
Why xojo don’t see my items in textarea?[/quote]
When you mentioned returning values in a TextField, I already thought you did not quite understand the relationship between the browser and the program.
What you change in JS is the content of the browser. Not the actual variable in the program that runs on the server. By using JavaScript on the DOM, which is by the way not recommended at all by Xojo, you change what you see, but not what is in the program. Just as putting a mustache on a photo will not add it to the model (thankfully).
What you need for the program to be aware of what is going on is to trigger an event that will send back the data to the program. What you do when changing the hashtag. What you could do with the WebSDK, instead of messing up with the DOM.
[quote=167136:@Krystof Jurecka]Okay, thank you Michel.
So hashtag is only one way, how to get something from javascript back to the xojo.[/quote]
That is the only simple way. The other way is to create a control with WebSDK which allows you to send an event back to the server. See WebSDK in the same folder as the Xojo app.