Tag: Dynamic

Scenario: You have dynamic checkboxes (multi-select) or radio buttons on your search form and after the search is complete, you want to redisplay the search form with your choices still selected.

Issue: Normally this is easy because you just set the field's default value to [get param="

Dynamic fields in search form - display choices after search

Solution:

  1. In the form settings, I added two new parameters to the URL, one for the ids of the checkboxes and one for the ids of the radio box. When doing this, use the following syntax [125 show="id"] where 125 is the field id.
  2. In the form’s After Fields section, add this jQuery script to use those new parameters and “manually” set the checkboxes and radio buttons. Replace 125 with the ID of your radio button and 124 with the ID of your checkbox. You should also change the variable names so they make sense with your application.
Problem:

We have a form that we use to collect entries. This is our “database” which has a view to display all of our entries. Not all entries are relevant to all users.

We want the user to be able to select which database entries are relevant to their business and be able to display them on their dashboard page.

Finally, we want the user to be able to go back to update or change their selections and for their previous selections to still be there. 

Solution:

We created a second form with a user id field and a dynamic field (checkboxes) that holds all of the titles of each entry in our database. The user will use this form to make their selections. Now we create a view from that form which we will call “Dynamic Selection”. In the content section of this view we write “[3696 show=id],” // change 3696 to your dynamic field. (Make sure the comma is there after the closing bracket). Now we’ll add the standard “User ID = current_user” filter along with sorting by “Entry Creation Date =  Descending”. Finally, set the “limit = 1”. Now we have a view that has our most recent entry ID for the current user.

After everything is set up correctly, copy the view shortcode and go back to the database view (first form’s view). Here we will add the filter “Entry ID = [display-frm-data id=17347]” // paste your own view shortcode. Now we have a dynamic field being used to filter the databases entries based on the checkboxes that are selected for that current user. 

Now for the final part, we are simply going to take our entry ID shortcode and paste it into the default value of the field in the Dynamic Field. This will make it so our checkboxes are always prepopulated with the user’s last selection.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right