Formidable Forms

Formidable Forms

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

frm_filter_final_form

Last Updated: May 2, 2018

Knowledge Base → Extend Formidable Forms → Formidable Hooks - for Developers → Form Appearance → frm_filter_final_form
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.

This hook can be used to make changes to the rendered form content before it is returned by the form shortcode.

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

Usage

add_filter( 'frm_filter_final_form', 'filter_hide_this' );
function filter_hide_this( $form )

Parameters

  • $form (string)

Examples

Use shortcode throughout HTML in form

You can use this this example code to place opening and closing shortcode tags to span throughout HTML fields in the form. This particular example shows how to use the shortcode for the Hide This plugin.

add_filter( 'frm_filter_final_form', 'filter_hide_this' );
function filter_hide_this( $form ) {
  global $shortcode_tags;
  $original_shortcodes = $shortcode_tags;
  $limited_shortcodes = array( 'hidethis' => $shortcode_tags['hidethis'] );
  $shortcode_tags = $limited_shortcodes;
  $form = do_shortcode( $form );
  $shortcode_tags = $original_shortcodes;
  return $form;
}

add_filter( 'frm_do_html_shortcodes', '__return_false' );

Minimize the form without the shortcode

The easiest way to minimize the form HTML is by adding minimize=1 to your [formidable] shortcode. But if every form on your site needs to be minimized, you can strip out the white space before it can be converted to <p> or <br/> tags with this:

add_filter( 'frm_filter_final_form', 'auto_minimize_forms' );
function auto_minimize_forms( $form ) {
  $form = str_replace( array( "rn", "r", "n", "t", '    ' ), '', $form );
  return $form;
}

Change a word

Use this code example to change a word or phrase in a form to another word or phrase. For example, you can change the word "Edit" that appears in the Summary field to "Revise."

To use the code example, replace "Edit" with the word or phrase you want to change and "Revise" with the word or phrase to which you want to change it.

Note: this code example will change all occurrences of the word or phrase in the form.

add_filter( 'frm_filter_final_form', 'change_edit_label' );
function change_edit_label( $form ){
    $form = str_replace( 'Edit', 'Revise', $form );
    return $form;
}

Remove icon and instruction

Use this code example to remove the SVG that appears with the press Enter text, as well as the Shift+Tab instructions at the bottom of the page in a Conversational form.

add_filter( 'frm_filter_final_form', 'remove_conversational_html', 15 );
function remove_conversational_html( $html ) {
	// Remove enter icons
	$html = preg_replace( '/<svg(.*?)d="M15.3 6c0 .7-.3 1.2-.7 1.7a2.2 2.2 0 0 1-1.7.7H7.4v2.3L.6 7.5l6.8-3.2v2.3H12c.3 0 .6-.1.8-.3.3-.2.4-.5.4-.8V.7h2V6Z"(.*?)\/><\/svg>/', '', $html, 2 );

	// Remove the "Shift+Tab" instruction
	$html = preg_replace( '/<div class="frm-key-instructions">(.*?)<\/div>/', '', $html, 1 );

	return $html;
}

Skip start page

Use this code to skip the first page with the start button in a Conversational form.

add_filter('frm_filter_final_form', 'skip_start_page', 15);
function skip_start_page( $form ) {
	$form = str_replace(
		'class="frm_active_chat_field frm_chat_start_page"',
		'style="display: none;" class="frm_active_chat_field frm_chat_start_page"',
			$form
		);
	return $form;
}
  • Usage
  • Parameters
  • Examples
    • Use shortcode throughout HTML in form
    • Minimize the form without the shortcode
    • Change a word
    • Remove icon and instruction
    • Skip start page
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

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