This shortcode allows you to set values, or parameters, that can be used within Views and forms. Once parameters are set using this shortcode, they can be used to filter Views, set default values within forms, and further customize form and View interactions.
Usage
In Pages or Posts
Insert the following shortcode before your form shortcode in a page or post.
[frm-set-get param_name="value"]
'param_name' = name of your new dynamic default value
'value' = value which will be retrieved with the get param shortcode
Insert the following shortcode in a field to retrieve the value of param_name.
[get param="param_name"]
'param' = name of the parameter that has been set in the url or shortcode
'default' = the value used if the value has not been set
In Views
This shortcode is most useful in a View. For example, if you are displaying an entry and would like to attach a contact form to send notifications to the email address attached to that entry, you could include something like this inside your View:
[frm-set-get contact_email="[26]"] [formidable id=x]
'26' = ID of email field from Form A
'x' = ID of Form B (contact form)
Insert the dynamic default value in the email field in Form B:
[get param="contact_email"]
Additional options
Saving complex values as params
frm-set-get can be used to save complex values, which can then be used as parameters in other shortcodes, like frm-condition and Conditionals. Use param=param-name to set the param name of your choosing, and enclose your complex content inside the frm-set-get shortcode.
[frm-set-get param=total_cost][frm-stats id=100 type=total user_id=current][/frm-set-get]
This sets the total_cost param as the user's total for field 100.
[frm-condition source=frm-field-value field_id=72 user_id=current less_than=param param=total_cost]You've exceeded your monthly limit.[/frm-condition]
The frm-condition shortcode will display the message "You've exceeded your monthly limit" if the user's value in field 72 is less than the value of total_cost param.
Notes:
- If frm-set-get is used inside a View, the parameter(s) it sets can't be retrieved inside the View using [get param].
You can get around this on Gutenberg pages by using the [show_param] shortcode instead of [get param]. The code for the [show_param] shortcode is here:
https://formidableformscom.bigscoots-staging.com/knowledgebase/php-examples/#kb-show-parameter-value-on-a-page.On pages created by the classic editor, you can put frm-set-get on the page above the View.
- Because of the way shortcodes are processed in WordPress, having shortcodes with enclosed content (e.g. [frm-set-get param=insight]Formidable rocks![/frm-set-get] mixed in with shortcodes without enclosed content (e.g. [frm-set-get answer=42]) may not yield the desired results.