Formidable Forms

Formidable Forms

  • Features
  • Pricing
  • Resources
    • Docs & Support
    • Blog
    • Community
  • Solutions
    • Web Applications
    • Calculators
    • Surveys
    • Directories
    • Payments
    • Contact forms
  • Login
  • Get Formidable Forms

Insert a Link to Update a Field

Last Updated: September 7, 2021

Knowledge Base → Entries → Editing and Deleting Entries → Insert a Link to Update a Field

Use this shortcode to insert a link which allows user to update a single field with one click. When using this shortcode, a link will be inserted that can be clicked to change a specific field in an entry to a value that you define. For example, you could add a "Mark as Complete" link that will change a field to "Complete" when clicked.

Formidable Forms is the best WordPress Form Builder plugin. Get it for free!

Usage

This shortcode adds an Update link that changes the value of a single field in a specific entry via Ajax. If the current value of that field is the same as the value parameter in your shortcode, the link will not be visible. This shortcode does not currently support fields set as post fields.

[frm-entry-update-field id=x field_id=y value="new value"]

'x' = ID of the entry to update. Make the entry ID dynamic in a View by replacing 'x' with [id].
'y' = ID of the field to change.
'new value' = the field value will be updated to match this value.

Note: You must first allow front-editing of entries for this shortcode to work. Only users who have the proper editing permissions will see the Update link.

Parameters

Required

  • id - ID of the entry to change. Use id=[id] in a View.
  • field_id - ID or key of the field to update.
  • value - The field value will be updated to match this value when the link is clicked. To pass the value of a specific field, replace "new value" with "[100]".
    Usage: [frm-entry-update-field id=x field_id=y value="[100]"]
    Replace 100 with the ID of the field that will be used as the new value.

Optional

  • label - The label for the update link. If not specified, this defaults to "Update". Usage: [frm-entry-update-field id=x field_id=y value="new value" label="Update"]
  • class - Add any HTML classes to the link here. Usage: [frm-entry-update-field id=x field_id=y value="new value" class="my_class"]
  • message - The text seen after the field value is changed. Usage: [frm-entry-update-field id=x field_id=y value="new value" message="The field has been updated"]
  • title - The title attribute for the update link. If not specified, the label parameter will be used for title. Usage: [frm-entry-update-field id=x field_id=y value="new value" title="Click to update"]

Examples

Send an Email After Field is Updated

If you would like to automatically send an email notification after a field has been updated with this shortcode, add the following code to the "Code Snippets" plugin or a child theme's functions.php file.

add_action('frm_after_update_field', 'frm_trigger_entry_update');
function frm_trigger_entry_update($atts){
  $entry = FrmEntry::getOne( $atts['entry_id'], true );
  $form = FrmForm::getOne( $entry->form_id );
  FrmFormActionsController::trigger_actions('update', $form, $entry, 'email' ); // Remove ", 'email'" if you want to trigger all form actions
}

Reload Page After Field is Updated

If you would like to allow an AJAX refresh after a field has been updated with this shortcode, you can follow the steps below:

  1. Add a custom class to your shortcode using the class parameter.
    [frm-entry-update-field id=x field_id=y value="new value" class="reload_page"]
  2. Add the following Javascript code to your theme's footer section. If the link is in a View, add the code to the After Content. You can also use a plugin like Simple Custom CSS and JS.
    <script>
    jQuery(document).ready(function(){
        jQuery('.reload_page').click(function(){  //replace reload_page with the name of the class specified in your shortcode 
            setTimeout(function() {
                window.location.reload(); 
            }, 3000); // change 3000 to number of seconds in milliseconds
        })
    })
    </script>

PHP Alternative

FrmProEntriesController::entry_update_field(array('id' => x, 'field_id' => 'y', 'label' => 'Update', 'class' => '', 'value' => 'new value', 'message' => 'Successfully Updated'));

'x' = ID of the entry.
'y' = ID of the field to change.

  • Usage
  • Parameters
  • Examples
    • Send an Email After Field is Updated
    • Reload Page After Field is Updated
  • PHP Alternative
Categories
×

Categories

  • Installation & Getting Started
  • Account Management
  • Forms
  • Entries
  • Views
  • Styles
  • Importing & Exporting
  • Add-Ons
  • Extend Formidable Forms

Using WordPress and want to get Formidable Forms for free?

Get Formidable Forms Lite Now

You do not have permission to view this form. Maybe you need to log in?

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.

Take on bigger projects Right Now

Get the tools you need to revolutionize your workflow and architect a masterpiece. Build the most advanced WordPress forms and actually use the data you collect in meaningful ways.

Get the most advanced WordPress form plugin and the only form builder with integrated Views.

Get Formidable Forms Now

Resources

  • Community
  • Affiliates
  • Contact
  • Free Online Form Builder

Top Features

  • Application Builder
  • Calculator Forms
  • Surveys & Polls
  • Quiz Maker
  • Form Templates
  • Application Templates
  • Directories
  • Donation Plugin

Company

  • About Us
  • Giving Back
  • Careers
  • Newsletter
  • WP Tasty
  • Nutrifox

Copyright © 2023 Strategy11, LLC. Formidable FormsĀ® is a registered trademark Strategy11, LLC.
Privacy Policy | Terms of Service | Sitemap

Join 300,000+ using Formidable Forms to create form-focused solutions fast. Get Started See User Reviews