Contact Form 7 – Dynamic Text Extension Knowledgebase

USEFUL? 1

Overview

The Dynamic Text Extension (DTX) is a very simple plugin that extends the functionality of Contact Form 7.

Out of the box in Contact Form 7, you can set a static default value for text inputs. For example, if you have a field with a “name” input, you could set the default of that field to “John”, and the name field would then be pre-filled with the text “John” when the user visits the page.

The DTX allows you to set this default dynamically, with the value generated by a shortcode. So a more useful example in the case above, we’d replace the static “John” with a shortcode that returns the logged in user’s name. Now the name input is pre-filled with the current user’s name when they view the form. The value is no longer static (“John”), but dynamic in that it changes based on the user viewing the form.

In short, the DTX just allows you to set the text that appears by default in a text input via a shortcode.

Requirements

  • An input element of type ‘text’ or ‘hidden’. The plugin does not currently support textareas, radios, selects, or other form field types
  • A shortcode that returns a value that can be rendered as text
  • A value that can be determined server-side (as all shortcodes are processed server-side)

What it doesn’t do

The DTX does not:

  • Work with fields other than text and hidden inputs
  • Change field values based on user page interactions (you need Javascript for that)
  • Provide a shortcode for every conceivable use case