There are virtually limitless possibilities for displaying data in a Formidable View. This article explains several commonly used View concepts that add more flexibility and functionality to your Views.
Set up a nested View
Typically, Views can only display data from one form. You can use a nested View, however, to display data from two forms inside of a single parent View. In order to set up a nested View, you must have a field in both forms that stores identical data. We'll refer to this field as the "shared field". It can be a user ID field, a field that stores a unique ID number, a Dynamic field, or even a Text Field.
The following instructions show one way you can can set up a nested View.
- Let's start by creating two forms. For this example we’ll have an “Employee Profile” form (Form A) which contains the fields “Name”, “Address” and “Employee ID Number”.We’ll also create an “Additional Details” form (Form B) which contains the fields “Employee ID Number” and “Date Of Birth”. For this example we will use the number field titled “Employee ID Number” as our shared field.
- Create a new View that displays entries from Form A; we'll call this View A. It will be the parent View that holds the nested View. We can now add some field IDs to the Content as if you were creating a basic View.
- Next, create a new View that displays entries from Form B; we'll call this View B. The View Format should typically be set to Single Entry. In the Content for this View, you should add the field IDs for the data you want to nest into View A — in this example it is our "Date of Birth" field.In the Advanced Settings, add a filter that says something like "Shared field is equal to [get param=pass_field]".
If you're using a User ID field as your shared field, your filter will say "User ID is equal to [get param=pass_field]".
For our example, the filter is "Employee ID Number is equal to [get param=pass_field]"
NOTE: The "pass_field" parameter of the filter can be anything — it is not linked to a field title or ID. If you change pass_field for something else, it must also be changed in the shortcode in the next step. This part of the filter must match the shortcode exactly.
- Go back to View A. Add this shortcode for View B inside of View A's Listing Page or Detail Page Content. It will look like this:
Formidable Forms is the best WordPress Form Builder plugin. Get it for free!
[display-frm-data id=x pass_field="[y]"]
Replace x with the ID of View B. Replace y with the ID of the "shared field" from Form A. If your shared field is a userID field, add show=ID to the shortcode:
[display-frm-data id=x pass_field="[y show=ID]"]
For our example, the ID of View B is , our shared field (Employee ID Number) is , and our get_param value is "pass_field" — so our shortcode is:
[display-frm-data id=158 pass_field=]
- Publish View A on a page. Include filter=limited in the view shortcode you insert on the page. This tells the view to process the shortcode for View B. When you visit that page, you should see entries from Form A alongside values from Form B.
Link to a View from another View
There may be times where you would like to link to the detail page of one View (View B) from another View (View A). A real-world example of this would be a case where we have a list of applications that were submitted for a job. We could have View A list all of the applicant's names, and View B list all of the details for a specific application. In scenarios like this, you can follow the instructions below to link to View B from View A:
- Create a new View (View B) and add some content to it.
- Go to the Advanced Settings for View B. Add a filter that says Entry ID equal to [get param=id]. Now save your View.
- Now that we have finished View B, let's publish it on a page. Make note of the URL of that page, as we will be needing it shortly.
- Create a new View (View A) and add some content to it.
- In the content box of View, we can add a link to View B. You link will most likely look like the following:
<a href="url-to-page-with-View-B?id=[id]">View Application Details</a>
Duplicate Entries on the Front End
If you would like users to be able to duplicate an entry from the front-end of your site, follow the steps below.
- Create a View which displays entries for your user to duplicate.
- Add a Duplicate button link to the content of the View by adding the page URL that contains your form. The easiest way to duplicate entries is to use the same form for the original and duplicate entries. Add an entry key parameter to the end of this URL. Your HTML link will end up looking like this:
Leave [key] as it is. This will dynamically generate the entry key.
- If you have an embedded form, you'll also need the ID for the embedded entry. Add the ID of the embedded form field to the URL like this:
Change 25 to the id of your embedded form field.
- Go into your form. Put [frm-field-value field_id=x entry=pass_entry] in each field and replace x with the ID of the field.
- Add this shortcode in the field options in the Default Value box.
- If it is a Dynamic field, you will need to get the ID of of the linked entry. You can do so with this shortcode: [frm-field-value field_id=x entry=pass_entry show=id] where x is the ID of your Dynamic field.
- If it is a field in an embedded form, add the default values in the other form. But instead of using entry=pass_entry, include entry=emb_entry.
- Add this shortcode in the field options in the Default Value box.
- Now when you click the "Duplicate" button or link, you will be taken to the form with the fields automatically populated with the entry's data. Please note that it is not currently an option to automatically populate multiple rows in a Repeatable Section.
Organize View by a field
There may be times you want to display entry data by a category, such as States, shown in the example below:
Follow the instructions below to categorize information in your View by a specific field in your form.
- Create a View for your form - this will be the View for the Cities in the example above. Set it to display All Entries and add any content you would like.
- In the Advanced Settings at the bottom, add a filter that sets the header field (State field in this example) equal to [get param="header"]. You can change 'header' to any text you would like.
- Create a second View for your form - this will be the View for the States in the example above. Set it to display All Entries. Add something like this to the Content:
[y] [display-frm-data id=x header="[y]"]
Replace x with the ID of the View created in step 1. Replace y with the ID of your header field (the State field in this example).
- In the Advanced Settings, add a filter that says "State is unique" so it only shows each State one time.
- Publish the second View on a page. When you visit that page, you should see entries displayed categorically.
Organize View by a Dynamic field
If you have a form (Form B) that includes a Dynamic field pulling entries from Form A, you can create a nested View setup to display entries categorically, with the Dynamic field as the category. Follow the instructions below to categorize entries in your View by a Dynamic field in your form.
- Create a View for the form (Form B) that contains the Dynamic field. Set it to display All Entries and add any content you would like.
- In the Advanced Settings, add a filter that sets your Dynamic field equal to [get param=data_id].
- Create a View for the form that your Dynamic field pulls entries from (Form A). Set it to display All Entries.
- Add something like this to the Content:
[x] [display-frm-data id=y data_id=[id]]
Replace x with the ID of a field in Form A. Replace y with the ID of the View created in step 1. Leave [id] as is. This will dynamically generate the entry ID.
- Publish the second View on a page. When you visit that page, you should see entries displayed categorically, with the Dynamic field as the category.
It can be very helpful to filter Views based on parameters in the URL, the current user, date ranges, etc. You can find more information on filtering entries here.