Is there any way to create a back button for multi-page forms. I can add another submit button but when you press the button it just goes to the next page with the HTML(Render form) code in the setup section of the form.
Basically I am wanting to create two buttons at the bottom of a form page, one to go back to the previous page and the second to continue to the next page. This would also be handy to create a verification page at the end of the form to verify that all information submitted to the form is correct before it is submitted. If it is not then can click on a button and go back to the page and correct it.
Any help would be much appreciated. Thank you for such a great product as is.
-Gorf
Hi Gorf,
I did this recently using a link formatted to look like a button that re-loaded the previous form step.
Bob
how is this done if im using ajax to submit the form on each step?
You can add a link too, but that page switch would not be in AJAX, that's the easy way!
Or you can assign a click event to the button and use the same AJAX code generated by CF, you will have to do some changes though, add the link to the page to load in a data attribute at the button, then use it to load that page!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Here you are:
jQuery(document).ready(function($){
$("#BUTTON_ID").on("click", function(){
$.ajax({
"type" : "POST",
"url" : $("#BUTTON_ID").data("page_url"),
"success" : function(res){
$("#FORM_ID").replaceWith(res);
},
});
});
});
Your button link (or button) must have this attribute:
data-page_url="link to page here"
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
hmmm maybe im missing something I cant get this to work at all ... the button doesnt do anything...
Your data param name is wrong! I have another idea, just add a hidden field to every page, and set its value to the url of the previous page, give this hidden field the same id in all pages, and change the "url" line in your code to this:
"url" : $("#HIDDEN_ID").val(),
Please pay attention to your button id as well, it should be the same in all pages if you have a back button in all of them!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ok thank you i will try this out...
ok so my back button id is set to "back1" and my hidden id is set to "hidden" , when i click the back button, it seams as if nothing is happening to it...
that's the code which should work after you replace the button id and the hidden field id, and your hidden field must contain the url to the previous page (or any page to load), I forgot something though, the url must end with "&tvout=ajax"
jQuery(document).ready(function($){
$("#BUTTON_ID").on("click", function(){
$.ajax({
"type" : "POST",
"url" : $("#HIDDEN_ID").val(),
"success" : function(res){
$("#chronoform-start").replaceWith(res);
},
});
});
});
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
I named the hidden field HIDDEN_ID and button BUTTON_ID just to make sure i didnt miss anything.... still scratching my head on this one.
That should be the "field id", not the "field name", are you sure you made that correctly ?
Please send me a link to the form so I can check it if so, you can do that in PM or email!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
I set it as name and ID ... sent you the link through PM
You still have the old code loaded on your page, you don't have the new one with this line:
"url" : $("#HIDDEN_ID").val(),
Please make sure that you use the latest code I have posted, paste it inside a "load javascript" action at the "on load" event
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Sorry i did do that you must have looked at it while I was trying to retrace my steps...
Please copy the code in my latest post there, you still have some differences like this line:
$(document).on('click', '#BUTTON_ID', function(){
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
ok im think there is a bug somewhere ... I just sent you a link to where this at ...
whenever I add this to the end of my URL "&event=submit" and I click the back button ... it works! and if I keep clicking submit it will actually trigger the hidden field and redirect me to the " tvout " url you provided, but its only the form nothing else....
Ok, few fixes were needed to the code and to the html action, the code below should work fine, but please send me a message using the contact us page to get the new html patch
jQuery(document).ready(function($){
$(document).on('click', '#BUTTON_ID', function(){
$.ajax({
"type" : "POST",
"url" : $("#HIDDEN_ID").val(),
"success" : function(res){
$("#chronoform-start").replaceWith(res);
}
});
});
});
Update: all hidden fields which have the urls will need to have the line below in the "Extra params" box:
alt=ghost
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Max,
I sent a message yesterday through the contact us, pleade check it, thanks!
It did not work? I tried to write the code into my multipage form, but nothing happened after clicking the back-button. It would be helpful to have a demo form with the back button.
Hi dgruhn,
it worked, please make sure that you have a hidden field with the previous page url, and make sure its available in all pages!
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
The back-button type is submit or button?
Hi dgruhn,
Just a button as far as I can see.
Bob
Max
I have a developer implemented a jQuery/livequery-based solution for the back button. He insisted that Chornoform's architecture does not permit each page to to preserve its states. As a result, as a user traverses back and forth through pages, every bit of data that he's entered will be lost… I would think the states can be preserved with JS somehow… Any suggestions on how to tackle this issue?
regards,
SH
Hi guys🙂 Happy new year !
I tried to applied the solution provided by Max. The button works as it displays the previous page. However, all my previous page javascript, dynamic dropdown and validations codes don't work anymore.
Anything I miss?
Thank you for your help🙂
Hi Goyens,
Have you got multi-page actions on both page events?
Bob