1

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 window onSave 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?

  • 3
    why do you want to refresh? Why do you not just update the page with AJAX? – elk Apr 15 '15 at 22:09
  • Good point. Realise it sounded a bit like an XY question before - updated with more context. – codinghands Apr 16 '15 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.