Docs & Support

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

Entries & ReportsListing Entries
Get a Value from an Entry

Get a Value from an Entry

Use this shortcode to get a value from an entry and display it in a page, post, View, or form field. It gets the value of a single field. This is helpful for automatically filling in forms for your users.

Usage

Insert the following shortcode in any page, post, View, or field.

[frm-field-value field_id=x user_id=current]

Replace x with the ID or key of the field that holds the value you want to get. If you don't include the user_id, entry, or ip parameter, the shortcode gets the value from the most recent entry submitted by any user.

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

Parameters

Who can see the value

Since Formidable Forms 7.0, the shortcode checks who is viewing the page when it gets a value from a specific entry. This keeps one user's entry values from showing to other visitors.

The check happens when you use the entry or entry_id parameter, user_id with a user ID, or ip with an IP address. The value then shows only to:

  • Users who can view entries in the admin area (administrators by default).
  • The person who submitted the entry. Since 7.0.1, that includes a logged-out visitor, in the same browser, for 1 hour after they submit it.

Everyone else, including other logged-out visitors, sees nothing, or the default value when you set one. The same check applies to [frm-condition source=frm-field-value] and to the PHP alternative.

Since 7.0.1, a field's Default Value shortcode shows to every visitor when it points to a fixed entry, user, or IP address, such as entry=25. It still checks who is viewing when the entry comes from the page address or the form shortcode, such as entry=pass_entry. It also checks who is viewing for a value from a Password or Credit Card field.

Administrators see values that other visitors don't. To see what your visitors see, check the page while logged out or as another user.

Two uses work the same way for every visitor as before 7.0: a shortcode without the user_id, entry, or ip parameter, and user_id=current. With ip=1, a logged-out visitor sees only the most recent entry submitted from their IP address while logged out.

To show a value to more visitors, use the frm_field_value_requires_ownership hook:

Only make a field public when its values aren't private. With entry=pass_entry, anyone can change the entry ID or key in the page address and see that field's value from any entry.

Required

field_id

ID or key of the field that holds the value you want to get. Each field ID is unique, whatever form the field is in.

[frm-field-value field_id=x]

You can also include these parameters to choose the entry. Use one of them, or combine entry with user_id=current:

user_id

Get a value from the most recent entry submitted by a specific logged-in user. Set user_id=current to get the most recent entry submitted by the current user, for example to fill in a form with their earlier answers.

[frm-field-value field_id=x user_id=current]

A specific user ID, such as user_id=12, returns a value only to administrators and to that user when they're logged in. user_id=current works the same way for every logged-in user. Learn more about who can see the value.

ip

Get a value from the most recent entry submitted from a specific IP address. Enter an IP address, or use ip=1 to use the IP address of the current visitor. Visitors don't need to be logged in.

[frm-field-value field_id=x ip=1]

With ip=1, a logged-out visitor sees only the most recent entry submitted from their IP address while logged out. A logged-in visitor sees the most recent entry from their IP address that they submitted, or that was submitted while logged out. Administrators see the most recent entry from that IP address, whoever submitted it.

An IP address you enter, such as ip="203.0.113.5", returns a value only to administrators and to the person who submitted the entry, including a logged-out visitor in the same browser for 1 hour.

entry

Get a value from a specific entry ID or key. If the entry ID or key is in the page address, like ?pass_entry=12345, use entry=pass_entry to get it from there.

You can also pass the entry ID or key as a parameter in a form or View shortcode. The entry_id parameter works the same way as entry.

[frm-field-value field_id=x entry="140"]
[frm-field-value field_id=x entry="entry_param"]
[frm-field-value field_id=x entry="entry-key"]

For example, to pass the entry in a form shortcode, add your own parameter to it, such as entry_param. Replace 12345 with the entry ID or key.

[formidable id=x entry_param=12345]

Then use the same parameter name in a field's default value in that form.

[frm-field-value field_id=x entry="entry_param"]

A value from a specific entry shows only to administrators and to the person who submitted that entry. This includes entry=pass_entry and a parameter you add to the form shortcode, such as entry_param, even in a field's default value.

A logged-out visitor sees the values from an entry they submitted in the same browser for 1 hour, and other visitors see nothing. To change that time, use the frm_guest_entries_cookie_expiration hook.

To get the value from a specific entry only when it belongs to the current logged-in user, use both the entry and the user_id parameters. The value shows only to the user who submitted the entry. Administrators don't see it unless they submitted the entry.

[frm-field-value field_id=x entry="entry_key" user_id="current"]

Optional

clickable

Create a clickable link to another resource.

[frm-field-value field_id=x clickable="1"]

default

Insert a default value in case there isn't a value to get. This value also shows to visitors who can't see the entry's value.

[frm-field-value field_id=x user_id=current default="Your name"]

format

Specify a format for date or time fields.

[frm-field-value field_id=x user_id=current format="Y-m-d"]

html

Include the HTML for an uploaded file. By default, this shortcode returns the HTML. Use html=0 to return the URL only.

[frm-field-value field_id=x user_id=current html=0]

remove_accents

Get a value without any accent marks.

[frm-field-value field_id=x remove_accents="1"]

sanitize

Convert spaces to dashes and make all the letters lowercase.

[frm-field-value field_id=x sanitize="1"]

sanitize_url

Convert characters into plain text for URLs.

[frm-field-value field_id=x sanitize_url="1"]

show

Get the entry ID from a Dynamic field by using show=id. This allows you to autopopulate Dynamic fields.

[frm-field-value field_id=x user_id=current show=id]

You can also get the ID number from a User ID field by using show=id. Replace x with the ID or key of your User ID field.

[frm-field-value field_id=x show=id]

You can also use show=value to get the saved value from a field with separate values.

[frm-field-value field_id=x user_id=current show=value]
Note: A frm-field-value parameter, such as field_id or entry, is treated as missing when it's left blank or set to 0. The shortcode then works as if you didn't include it.

Examples

Automatically populate a date field

By default, the [frm-field-value field_id=x user_id=current] shortcode displays a date in the format selected in your WordPress settings. To automatically populate a date field with the frm-field-value shortcode, use this shortcode:

[frm-field-value field_id=x user_id=current format="Y-m-d"]

Automatically populate an address field

To automatically populate an address field, use these parameters to get specific parts of the address field with the frm-field-value shortcode. In the Address field options, insert the frm-field-value shortcode in the Default Value box for each part of the address.
Get Value Address Field Options
In these examples, replace 155 with the ID or key of the address field in the entry you're getting the value from.

  • Autopopulate the first line of the Street address
    [frm-field-value field_id=155 show=line1]
  • Autopopulate the second line of the Street address
    [frm-field-value field_id=155 show=line2]
  • Autopopulate the City
    [frm-field-value field_id=155 show=city]
  • Autopopulate the State
    [frm-field-value field_id=155 show=state]
  • Autopopulate the Zip Code
    [frm-field-value field_id=155 show=zip]
  • Autopopulate the Country
    [frm-field-value field_id=155 show=country]

Get Value Autopopulate Address Field

Using truncate

Use the truncate parameter to set the number of characters. Replace x with the ID or key of the field in the entry you're getting the value from.

  • Truncate text to 2 characters.
    [frm-field-value field_id=x truncate=2]
  • Truncate text to 10 characters.
    [frm-field-value field_id=x truncate=10]
  • Truncate text to 100 characters.
    [frm-field-value field_id=x truncate=100]
  • More Text: By default, this is "..." but you can change it with the more_text parameter.
    [frm-field-value field_id=x truncate=100 more_text="...Read More"]

PHP alternative

These PHP functions return the same value as the shortcode, with the same check on who can see the value.

Get a value by user ID

FrmProEntriesController::get_field_value_shortcode( array( 'field_id' => x, 'user_id' => 'current' ) );

Replace x with the ID or key of the field that holds the value you want to get.

Get a value by entry ID

FrmProEntriesController::get_field_value_shortcode( array( 'field_id' => x, 'entry' => $entry_id ) );

Replace x with the ID or key of the field that holds the value you want to get. $entry_id must be set in your code.

The value is returned only when the current user is an administrator or submitted that entry. Otherwise, the function returns an empty value.

Limitations

  • Using [frm-field-value field_id=x truncate=1] truncates the text to 50 characters. Use this code snippet to change it.
  • This shortcode doesn't work with Repeater fields.
Learn where to put the code when adding a custom PHP function to your site.

Use a value in a conditional statement

You can use [frm-field-value] in conditional statements with the built-in frm-condition shortcode.
  1. Create a new shortcode that lets you use values from frm-field-value in conditional statements. You can use any of the parameters above in this shortcode, plus equals.
    [maybe-frm-field-value field_id=x user_id=current equals=5]show it[/maybe-frm-field-value]
  2. Add this code in your theme functions.php or a new plugin to create the new shortcode:
    function maybe_frm_value_func( $atts, $content = '' ) {
          $val = FrmProEntriesController::get_field_value_shortcode($atts);
          if($val == $atts['equals']){
            return $content;
          }else{
            return '';
          }
    }
    add_shortcode( 'maybe-frm-field-value', 'maybe_frm_value_func' );

Get the total of two or more fields

This shortcode adds the values of the specified fields in the current user's most recent entries and returns the total. The fields can be from different forms or the same form.

[fields-total ids="25,100,113"]
add_shortcode('fields-total','ff_fields_total');
function ff_fields_total($atts){
    $defaults = array(
     'ids' => '',
     'user_id' => 'current',
    );
    $atts = array_merge($defaults, $atts);
    $ids = explode( ',', $atts['ids'] );
    unset( $atts['ids'] );

    $total = 0;
    foreach ( $ids as $id ) {
	  $atts['field_id'] = $id;
	  $total += (int)FrmProEntriesController::get_field_value_shortcode($atts);
    }
    return $total;
}

Add custom truncate

To add a custom truncate option to the [frm-field-value] shortcode, use the example below.

[frm-field-value field_id=x custom_truncate=1]
add_filter('do_shortcode_tag', 'truncate_frm_field_value', 10, 3);
function truncate_frm_field_value($output, $tag, $attr) {
    if ('frm-field-value' === $tag && isset( $attr['custom_truncate'] ) && is_numeric( $attr['custom_truncate'] ) ) {
        $output = FrmAppHelper::truncate($output, $attr['custom_truncate'] );
    }
    return $output;
}
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