Invalid Web Dialog
-
I have been using a web dialog as an interface and lately I've been getting the error "#<Exception: Invalid Dialog>" if I submit more than once. Does anyone know why this is?
I am using mostly get_element_value instead of parameters.
-
@cjthompson said:
lately I've been getting the error "#<Exception: Invalid Dialog>"
Never saw that. Can you post some code?
-
I've been trying to get a code snippet to replicate the problem, but I haven't been able to. I just wanted to know if anyone else has had this problem.
-
CJ,
@cjthompson said:
if I submit more than once.
Can you please clarify what exactly you mean by submit? Not sure if you mean HTML form submit or not...
If you do, I have only used a button onclick event and a trap for escape.
Greg
-
sorry, I meant executing window.location = skp:callback_method_name.
I think this might be an issue with ASP. I haven't been able to replicate it with html.
-
Okay. This is just plain stupid.
I stepped through my code to find the problem, and it turns out that somehow creating a new bounding box invalidates my web dialog.
here is a code snippet to test with (I used the console):
testWebDialog = UI;;WebDialog.new("Test;",true,"webDAtts",700,500) testWebDialog.set_html("<head></head><body>This is a test</body>") testWebDialog.show puts testWebDialog.visible? #(should return true) Geom;;BoundingBox.new puts testWebDialog.visible? #(should return false)
-
I noticed that this was fixed in 7.1
-
-
If you create a dialog assigning a @class variable to reference it, and the dialog is closed, then the variable holds a reference to the now invalid dialog.
Typical code
def create_dialog if !@dlg @dlg = UI;;WebDialog.new( ... ) end @dlg.show { } end
Now if the dialog is closed, the @dlg variable still holds a reference to the now invalid dialog. In addition to checking whether the @dlg variable exists, you need to check if the dialog is visible?
def create_dialog unless @dlg and @dlg.visible? @dlg = UI;;WebDialog.new( ... ) end @dlg.show { } end
-
Or just recreate the dialog every time...
def create_dialog @dlg = UI;;WebDialog.new( ... ) @dlg.show { } end
Advertisement