The [frm-condition] shortcode is used to compare two values before displaying something on the page. Compare a field value another field value, a value in the url, a stat returned by the frm-stats shortcode, and many more.
Use it in a view, directly on a page, in an email, as a default value, or anywhere else that shortcodes are processed.
- source - Where to get the first value for comparison. Use the name of any other shortcode (including a custom shortcode) or 'param'.
- equals, not_equal, greater_than, less_than, like - Include the second value to compare. ie equals=10 or greater_than=100.
- param - If source=param is used, set the name of the param in the URL.
- Any parameter to pass to the shortcode specified in the 'source' parameter.
Compare two fields in a View
Show a value when field 391 and 390 are the same. Change these field ids to match your own. [id] is left as is as long as you are comparing to a value in the same entry.
[frm-condition source=frm-field-value field_id=391 entry=[id] equals=""]your content here[/frm-condition]
Compare a statistic
This example will show the statistic from the frm-stats shortcode only when it is higher than 10. Replace 'text-field' with the id or key for the first field to compare.
[frm-condition source=frm-stats id=text-field type=count greater_than=10][frm-stats id=text-field type=count][/frm-condition]
Show a message on a page
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 in the URL or set in another shortcode.
[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]
Check the value of a param
Test if a param is set or has any value. Replace 'color' with the name of the param you want to test.
[frm-condition source=param param=color]content to show if the color param is set[/frm-condition]
Test if a param has a particular value.
[frm-condition source=param param=color equals="yellow"]content to show if the color param is set to "yellow"[/frm-condition]