I have a from in dialog. Everything works percectly, but how can I refresh the values in inputs after save data in db?
Is there a trick to refresh whole form or should I use dialog.reset() when someone hides dialog by pressing Cancel button? If it could be done only by reset() method, so how can I handle event when escape is pressed and the closing-cross (in the top-right corner)
Best regards
Usually, if a user closes a dialog, I just destroy the thing and create a new one.
You can use something like this to capture when the user has closed the dialog, and clean it up:
Note that the fact that you use the
connect()method on the dialog widget means that the connect itself will also be cleaned up when the widget is destroyed.Nice and neat 🙂
If you are just looking to clear the form, you can use
document.myform.reset()in the close connect.A more complete example:
Now, one thing about this is that is does introduce a global name (myDia). But you can easily make that a member of an object and that won’t be the case. showDia should also be a member method on an object (ie, not a global function).
Also, this is often done by using a content pane to pull in the content from a URL.