Open modal on form submit?

There isn't really anything that can do it by default, so it would require custom code to handle it.

Vaguely speaking if the form is being submitted using the AutoValidator then you can listen to certain events, prevent the default actions where applicable, and then just instantiate an overlay.

There's a few code examples in XFMG where an overlay is launched entirely using JS, though none specifically as a consequence of submitting a form. In XFMG 1.1:

Code:
options = {};
options.speed = XenForo.speed.fast;

this.trigger = { href : $(this).attr('href') };

this.OverlayLoader = new XenForo.OverlayLoader($(this.trigger), true, options);
this.OverlayLoader.load();

Where "$(this).attr('href')" is the URL of the overlay that needs to be opened.
 
There isn't really anything that can do it by default, so it would require custom code to handle it.

Vaguely speaking if the form is being submitted using the AutoValidator then you can listen to certain events, prevent the default actions where applicable, and then just instantiate an overlay.

There's a few code examples in XFMG where an overlay is launched entirely using JS, though none specifically as a consequence of submitting a form. In XFMG 1.1:

Code:
options = {};
options.speed = XenForo.speed.fast;

this.trigger = { href : $(this).attr('href') };

this.OverlayLoader = new XenForo.OverlayLoader($(this.trigger), true, options);
this.OverlayLoader.load();

Where "$(this).attr('href')" is the URL of the overlay that needs to be opened.
Thanks for taking the time, Chris. Very helpful.

Would you be able to actually send form data to this new modal? Or do you think Id need to store that data differently (in which case I don't really necessarily need the <form> tag).
 
You possibly could send form data into the overlay, yeah. Most "Preview" forms in XF work like that (e.g. Preview Post, Preview Notice).
 
Back
Top Bottom