In a component I'm building I plan on having a 'new item' screen featuring a button that will, on click, allow a modal selection from a 'list' view using a custom modal form field type.
Once done, I'd like the page to refresh with the fields entered thus far are still filled in, and then pull data related to the modal selection to continue creating the new item.
As an example, the New Menu Item screen does this when you select a Menu Item Type.
I realise I could...
Pass the data back through the modal JS function, but 1) I want to develop a single approach I can use for modal selection, modal edits and modal creation within an item, and 2) the data may not exist in the selection modal, but elsewhere
Trigger an event in the modal on the
windowonSave that is handled by the parent window, making an AJAX request once we're back from the modal to get the new data, but writing AJAX code for the request, injection of new data, a server handler, debugging, errors etc. seems like creating work when a simple refresh would automatically pull all the new data anyway.
How is this possible?