Send string value to Webdialog
-
This is how it can be done (besides JSON)
Example.
In ruby
name="blablabla" command = "_showdata('taskname', '#{name}')" dialog.execute_script(command)
In webdialog
function _showdata(id,value) { var element = document.getElementById(id); element.value = value; }
The only problem i have is:
Ruby continues interpreting script without waiting.
For example: if the dialog is not yet open, you test on that and first open the dialog, the value will not be shown in the dialog. App. the ruby script just continues without waiting tille the dialog is open. Now if i place a UI.messagebox just before the command line all goes well.Is there any way to hold the ruby script so it only continues if the dialog script is executed? Or is there another way to do this?
-
I suppose you could make up an array of commands that would stack up if the webdialog isn't open. Then, when it does loop through and send them.
-
Maybe use the
show{}
method to defer execution?dlg = WebDilaog.new(...) #... dlg.show { # your code here }
-
If you are going to open a web dialog I would recommend you always control the action from the dialog's javascript - onload call ruby callback > receive ruby execute script.
Chris
-
Hey Chris,
Do you have an example for me?
Thanks! -
Open transformations.zip from here.
Let me know if you have any problems.
Chris
edit: in my last post there
-
ok i'll look into it
Thanks!
Advertisement