Now getting back to some real blog content, and to clear out some of the backlog…….
Not too long ago, at work, I ran into the problem of using a url backed by a Spring SimpleFormController inside of a Dojo modal dialog widget. The modal dialog was intended to modifiy the properties of some object on the parent page. The goal was to have the dojo dialog open, populate the dialog with the contents of the url, submit the form and if successful, close the dialog and update the parent; otherwise show the errors.
Our solution was to use Prototype’s Ajax.Updater to populate the div and submit the form.
After that, we needed to write the script to actually open the dialog, populate it, and submit the results.
showDialog()is the entry point into the widget. It’s function is to initialize some global variables and then call
Ajax.Updater. The parameters for the function are
formUrl(the url for Ajax.Updater to retrieve),
outerFormId(the form id of the parent), and
modelId(the id of the model object we are attempting to modify). Calling
Ajax.Updaterusing the ‘get’ method triggers the show initial view path in the spring controller. This is exactly as if the user had navigated to the url manually. However, instead of the contents replacing the contents of the browser window, they are placed into a previously hidden div on the parent page. Our dialog in this case has two buttons: cancel and save. The cancel button calls the
Did you like this? Please share:
The Lost Year: A Failed Experiment to Switch Away From Mac
Fed up with the Apple Keyboard, I bought a ThinkPad, installed Linux, and promptly decided that I hated computers.
Maker's Space, Manager's Space
The Grand Remote Work Experiment: A Retrospective
The COVID-19 pandemic has lead to an unexpected experiment in remote working. What has worked and why?