mardi 28 juin 2016

Gravity Forms custom multi-page form

I'm creating a project where I need to use Gravity Forms multi-page forms. This form is to create a custom membership with different types of aircrafts. On the first page on the form is where I select the aircraft and the next page is to select the number of hours, the next are perks, add-ons, and finally the last page is a summary.

I created a Custom Post Type for the aircrafts and then added ACF option pages in this custom post type for Hours, Perks, and Add-ons.

I am using the following filters to get the Categories of the aircrafts, aircrafts themselves, hours, perks and add-ons to populate checkbox fields on Gravity Forms.

add_filter( 'gform_pre_render_6', 'your_function_here' );
add_filter( 'gform_pre_validation_6', 'your_function_here' );
add_filter( 'gform_pre_submission_filter_6', 'your_function_here' );
add_filter( 'gform_admin_pre_render_6', 'your_function_here' );

Each type (Category, aircraft, perks, hours and add-ons) has its own function to populate into the gravity form field checkboxes.

Each aircraft has its own custom fields for range, luggage capacity, etc... I need to display these posts and their custom fields for each Checkbox. How i'm currently doing this is with Underscore JS to filter through what categories I select and display those aircrafts.

I can not get this information then to display so I use jQuery to move these elements in their own <li class="gfield"> element and place it above the checkboxes. Please tell me if this is the best way to do this.


ISSUE #2

Now my next issue is when I navigate to the next form page, the information that I have displaying above their respective checkboxes is also being moved by jQuery. Now If I select say a specific number of Hours and then decide I want to change my aircraft, I hit the "Previous Step" button and then my aircrafts don't display as well as the category.

Now if I try to navigate back to the hours, the hours that I have displaying above their respective checkboxes do not display. It seems they all disappear or break?

I have tried using gform_post_render and gform_page_loaded and nothing seems to be help to display these items back to where they were supposed to go.

I've tried looking all over the place for help and I have no idea what to do.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire