Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

frm_action_logic_value

Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Make adjustments to the value used in form action logic. This filter is run each time a row of logic is evaluated at the time a form action is triggered.

The frm_action_logic_value filter runs twice for each row. The first time, it receives the value saved in the logic row. The second time, it receives the value from the entry for the field the row checks, with the entry and field ID.

Usage

add_filter( 'frm_action_logic_value', 'frm_change_logic_value', 10, 2 );
function frm_change_logic_value( $logic_value, $args = array() ) {

Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

Parameters

  • $logic_value (string): The value saved in the form action conditional logic.

When the filter runs for the value from the entry, it receives these parameters instead:

  • $observed_value (string|array): The value from the entry for the field the row checks.
  • $args (array):
    • 'entry' (object): The entry being checked.
    • 'field_id' (int|string): The field the row checks. When the row uses part of a Name or Address field, this is the field ID and the part, such as '12_first' or '25_zip', and $observed_value holds only that part. When the row uses a whole Name field, $observed_value is the full name.

Examples

Learn where to put the code when adding a custom PHP function to your site.

Compare only the first five digits of a zip code

Use this code when a form action condition checks Address (Zip/Postal), and a visitor may enter a ZIP+4 code such as 97201-1234. The condition "Address (Zip/Postal) equals 97201" then matches it.

add_filter( 'frm_action_logic_value', 'frm_compare_five_digit_zip', 10, 2 );
function frm_compare_five_digit_zip( $value, $args = array() ) {
	$zip_part = '25_zip'; // Change 25 to the ID of your Address field.

	if ( isset( $args['field_id'] ) && $zip_part === (string) $args['field_id'] && is_string( $value ) ) {
		$value = substr( preg_replace( '/\D/', '', $value ), 0, 5 );
	}

	return $value;
}

Replace 25 with the ID of your Address field and keep _zip at the end. The field ID shows next to the field name at the top of the Field Options tab.

Change Log

Added in version 4.04.05. The entry value and $args were added in version 4.06.02. Name and Address parts (field IDs such as '12_first') were added in version 7.0.

Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2026 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Complete your purchase
    Don't forget your purchase!
    Complete Purchase
    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms