Hello
I'd like to know how to do to display the confirmation of a form in a mediabox.
Thanks in advance
Hello
I'd like to know how to do to display the confirmation of a form in a mediabox.
Thanks in advance
I can at least point you in the right direction. Typically it involves 2 parts:
1. Intercept/stop the form submission using MooTools and submit the form via AJAX instead:
http://mootools.net/docs/core/Request/Request
http://mootools.net/docs/more/Forms/Form.Request
2. Upon getting a success response, manually open a new Mediabox, pointing to either a separate thank you page, or some inline content.
http://iaian7.com/webcode/mediaboxAdvanced/#scripting
There should also be some examples online if you do a search.
Brian
Thank you I'll try this way.
If someone have an example it will be welcome !
With your indications I found the following page which works:
http://fourmilestomay.com/2009/submitti ... xadvanced/
But I'd like to know if there is a way to get the page alias in the javascript of the template page as the {{page::alias}} tag doesn't work;
Is it possible to get the form ID as well automaticaly.
With this completement it will be completely flexible.
Thank you
I think I understand -- you want the Alias and CSS ID so you can plug into the JavaScript, correct?
You actually don't need either to do this. Instead, give any form you want to submit via AJAX a CSS class (which you can add in the backend CSS ID/class field). If you give it something like "ajax" you can do the following:
Code:<script> window.addEvent("domready", function() { // When any form with a class of "ajax" gets submitted... $(document.body).getElements("form.ajax").addEvent("submit", function(e) { // Stop sending, and set some AJAX options... e.preventDefault().target.set("send", { // For example, on a successful submission... onSuccess: function(response) { // Here's where you do your other stuff, like opening a Mediabox window. // "response" will hold the HTML content of the thank you page, BTW. } // OK, everything's set. Go ahead and submit... }).send(); // Note that you don't even need to pass the "action" this way // (MooTools figures it out for you), // so you don't need the alias anymore. }); }); </script>
Brian
Did you have any luck with this, I've noticed there's an extension to do the same thing but only for versions 3+. I'm trying to do this in 2.11.11. I have tried the script you suggested but with no luck, any help would be greatly appreciated.
Bookmarks