Reset a web dialog

The documentation explicitly states that you should drag a WebDialog class into a WebPage to display it within the page. This is fine and works fine, except for when you want to use the dialog to view/edit information for a class more than once. When you use the close method of the dialog it doesn’t actually close, and everything that was change remains changed in the dialog.

On the desktop you’d obviously just create a new instance of the dialog and display it, but again the docs seem to imply that you should do this. Is there an easy way to reset a web dialog that is within a page? Is there any actual danger to simply creating the instance in code and showing it within the webPage to ensure it gets a clean instance every time?

Creating them in code is the best way to ensure a clean instance.

Greg, correct me if wrong…but I believe in very early versions of WE there were some issues creating WebDialogs via code. But now it should be OK.

I guess this was the part of the docs that made it seem like you HAD to add it to the WebPage in the IDE instead of via code:

Maybe that should be reworded if it isn’t actually necessary? Or is it that you should simply create a property within the webpage (instead of within a method/event) to make sure the dialog isn’t released before it should be?

It’s been a very long time since that was true. Call me optimistic, but I always hope that people are using a recent version of Xojo :slight_smile:

You are right. I’ll get a note to Paul about that.