Web Dialog and Data
-
Hi friends,
I would like to create a html webdialog to send data (text, radio state, checkbox state, etc) as variables to ruby script. After that, I´ll work these variables and return results on other html as text only.
Is it possible without javascript?
Thanks.
Sérgio Bizello -
No. Ruby communicates back and forth with Webdialogs using JS. No way around that.
Any particular reason you don't want to use JS? -
Or saying that... webdialog.get_element_value retrieves the value of input elements without any JS.
-
@thomthom said:
No. Ruby communicates back and forth with Webdialogs using JS. No way around that.
Any particular reason you don't want to use JS?Hi,
Well, I just wanted to use the least possible languages. If no possible, ok.
Do you know a site where I can see and learn a simple code in JS to capture information from webdialog and show information on a webdialog?Thanks TT
-
@thomthom said:
Or saying that... webdialog.get_element_value retrieves the value of input elements without any JS.
Ok... I'll see how it works, but if you have some example, send me if you can. I'll be grateful for this help too.
Thanks again TT.
SérgioBizello -
http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/webdialog.html#get_element_value
The example has been mangled though. should say:
# In Ruby code; dialog.get_element_value("myTextInput") # In webdialog's HTML; # <input id="myTextInput" value="hello" type="text">
-
@thomthom said:
http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/webdialog.html#get_element_value
The example has been mangled though. should say:
> # In Ruby code; > dialog.get_element_value("myTextInput") > > # In webdialog's HTML; > # <input id="myTextInput" value="hello" type="text"> >
How is the data transmission? After clicking the OK or closing the dialog box? I'm sorry the basic question but, I'm a begginer and I doubt it. If the webdialog has checkbox, radio, etc. This works with these types? Or have any exception?
Thanks -
.get_element_value
is a method that immediately returns the value of the input element.myVariable = dialog.get_element_value("myTextInput") puts myVariable
That snippet will take the value ofmyTextInput
and assign it to the variablemyVariable
and then prints it to the Ruby Console. -
@bizello said:
How is the data transmission? After clicking the OK or closing the dialog box? I'm sorry the basic question but, I'm a begginer and I doubt it. If the webdialog has checkbox, radio, etc. This works with these types? Or have any exception?
Should work for checkboxes and radio boxes. they are also INPUT type HTML elements. Not sure about SELECT and TEXTAREA fields etc. Haven't tried them.
-
Moved the thread to the Developer's forum. We have reorganized so that the Plugin section is only a list of plugins you can download and use.
Advertisement