Form-tag features

Posts in the developer's cookbook category describe topics that require technical knowledge. Be warned and use the techniques at your own risk. Unless you are an experienced developer, you are strongly advised to ask a professional for support.

Do you remember when we learned how to register a custom form-tag type in a previous recipe? We used the wpcf7_add_form_tag() function and set the third parameter to array( 'name-attr' => true ).

We call it features of a form-tag. Contact Form 7 has a set of predefined features (listed below), and, by specifying some of them through a form-tag type declaration, you can characterize each form-tag instance of the type.

display-block

On rendering, a form-tag supporting display-block generates an HTML element that is usually displayed as a block, such as <div> or <p>.

Native form-tag types that support this feature are:

  • recaptcha (reCAPTCHA v2 widget)
  • reflection
  • response
  • stripe

display-hidden

On rendering, a form-tag supporting display-hidden generates an HTML element that is not visible, such as <input type="hidden" />.

Native form-tag types that support this feature are:

  • hidden

do-not-store

On accepting submission, user input data through a field of a form-tag supporting do-not-store is not stored by data storage modules such as Flamingo.

Native form-tag types that support this feature are:

file-uploading

A form-tag supporting file-uploading represents a file uploading field.

Native form-tag types that support this feature are:

  • file
  • file*

multiple-controls-container

On rendering, a form-tag supporting multiple-controls-container generates an HTML element that can contain multiple form-controls.

Native form-tag types that support this feature are:

  • checkbox
  • checkbox*
  • radio

name-attr

A form-tag supporting name-attr represents a form-control or a group of form-controls that has a name attribute. The name attribute value will be derived from the name part of the form-tag.

Native form-tag types that support this feature are:

  • acceptance
  • checkbox
  • checkbox*
  • radio
  • count
  • date
  • date*
  • file
  • file*
  • hidden
  • number
  • number*
  • range
  • range*
  • quiz
  • captchac
  • captchar
  • select
  • select*
  • text
  • text*
  • email
  • email*
  • url
  • url*
  • tel
  • tel*
  • textarea
  • textarea*
  • reflection
  • output

not-for-mail

A form-tag supporting not-for-mail can have a value, but the value is not expected to be used within an email message.

Native form-tag types that support this feature are:

  • count
  • quiz
  • captchac
  • captchar
  • reflection
  • output

selectable-values

A form-tag supporting selectable-values represents a group of options from which you can select one or more options.

Native form-tag types that support this feature are:

  • select
  • select*
  • checkbox
  • checkbox*
  • radio
  • acceptance

singular

If a form-tag type supports singular, you are not allowed to use two or more form-tag instances of the same type within a form.

Native form-tag types that support this feature are:

  • stripe (Stripe payment widget)

zero-controls-container

On rendering, a form-tag supporting zero-controls-container generates an HTML element that contains no form-control.

Native form-tag types that support this feature are: