I have this set up at the moment:
A WordPress site, I'm using something similar to http://barbajs.org/
So every page content is loaded through ajax to a <main></main>
tag.
In one of the pages (contact page), I have a gravity form and is using a page break. The form is made into steps and each step is loaded inside the page. Everything is working if the first page that I load is that page (contact page), but as soon as I go to a different page and come back, or if I go to contact page from a previous page the form doesn't work anymore.
Any ideas on how to fix it. This is the code part:
Wordpress: WYSIWYG with shortcode
[gravityform id="2" title="false" description="false" ajax="true"]
On load, I have this:
jQuery('#gform_wrapper_2').show()
(This is the only thing that works), so I don't get a black page.
If I click on next step (it doesn't load next step) and I've tried this:
This I found on the documentation or in the next button under onclick = "..."
jQuery(document).trigger('gform_post_conditional_logic', [2, null, true])
jQuery(document).bind('gform_post_conditional_logic', function(event, formId, fields, isInit){} )
jQuery(document).trigger('gform_post_render', [2, 1])
jQuery("#gform_target_page_number_2").val("2");
jQuery("#gform_2").trigger("submit",[true]);
I will need something like gform.init()
ideally :D or something similar that lets me bind the form again.
Thanks a lot!
After digging a bit into gravity form plugin I was able to fix this.
So here is what I did.. hope it helps somebody in the future (not sure if the best solution but it works):
So the "main" idea is that barba or whatever you are using (in my case biggie) is making an ajax call for a new page and you will have something like a ready / newPageReady function, in here you make a new ajax call to get your form.
JS: (Given that gform uses jquery you can use it)
Functions.php