CYBER MONDAY - 30% OFF Use coupon CM30 at checkout - Learn more

The Variable Cheat SheetPRO

While you can achieve a whole lot in WS Form without using variables, you can create even more dynamic and powerful forms using them.

Variables can be used in a variety of places, including:

Below are some common variable combinations our customers use in WS Form.

Fields

Example Description Where To Use
#field(123) Returns the value of field ID 123.
  • Email templates
  • PDF templates
  • Action settings
  • Conditional logic THEN / ELSE values
#field(123, "/") Returns the value of field ID 123, delimiting multiple values with the / character.

Learn more about the delimiter parameter.

  • Email templates
  • PDF templates
  • Action settings
  • Conditional logic THEN / ELSE values
#field(123, "/", "Width") Returns the value found in the Width column of field ID 123, delimiting multiple values with the / character.

Learn more about the delimiter and column parameters.

  • Email templates
  • PDF templates
  • Action settings
  • Conditional logic THEN / ELSE values
#field(123, "/", 2) Returns the value found in column index 2 (third column) of field ID 123, delimiting multiple values with the / character.

Learn more about the delimiter and column parameters.

  • Email templates
  • PDF templates
  • Action settings
  • Conditional logic THEN / ELSE values
#text(#field(123)) Dynamically returns the value of field ID 123. The value is updated whenever field ID 123 changes.

Learn more about the #text variable

  • Conditional logic THEN / ELSE values
  • Field label
  • Field default value
  • Field placeholder
  • Field help
  • Field content (Text Editor and HTML field types)
  • Field min / max attributes
#calc(#field(123) + #field(321)) Returns the sum of field IDs 123 and 321. The sum is updated whenever field ID 123 or 321 changes if it is used in field settings.

Learn more about the #calc variable

  • Conditional logic THEN / ELSE values
  • Field label
  • Field default value
  • Field placeholder
  • Field content (Text Editor and HTML field types)
  • Field help
  • Field min / max attributes

Sections

Example Description Where To Use
#section_row_count(123) Returns the number of repeatable rows in section ID 123.

Learn more about repeatable sections

  • Client-side
#calc(#section_row_count(123) * 10) Returns the number of repeatable rows in section ID 123 multiplied by 10. The value is updated whenever the number of rows in section ID 123 changes.

Learn more about repeatable sections

  • Client-side
#section_row_number Returns the current section row number. This is useful for numbering repeatable sections.

Learn more about repeatable sections

  • In a field inside a repeatable section.

Submissions

Example Description Where To Use
#submit_id Returns the submission ID.
  • Email templates
  • PDF templates
  • Action settings
#submit_hash Returns the submission hash.
  • Email templates
  • PDF templates
  • Action settings
#submit_url Returns a URL that can be used to return back to a saved submission.

Learn more about save and continue

  • Email templates
  • PDF templates
  • Action settings

#if … #endif

Example Description Where To Use
#if(#field(123))You entered something in field ID 123#endif Returns You entered something in field ID 123 if field ID 123 is not blank.
  • Email templates
  • PDF templates
  • Action settings
  • Conditional logic THEN / ELSE values
#if(#field(123) == "Option 1")You chose option 1#endif Returns You chose option 1 if field ID 123 equals Option 1.
  • Email templates
  • PDF templates
  • Action settings
  • Conditional logic THEN / ELSE values
#if("#text(#field(123))" == "Option 1")You chose option 1#endif Dynamically returns You chose option 1 if field ID 123 equals Option 1. The value is updated whenever field ID 123 changes.

Learn more about the #text variable

  • Field label
  • Field default value
  • Field placeholder
  • Field help
  • Field content (Text Editor and HTML field types)
  • Field min / max attributes
#if(#calc(#field(123)) > 10)Number greater than 10#endif Dynamically returns Number greater than 10 if field ID 123 contains a number greater than 10. The value is updated whenever field ID 123 changes.

Learn more about the #calc variable

  • Email templates
  • PDF templates
  • Action settings
  • Conditional logic THEN / ELSE values
  • Field label
  • Field default value
  • Field placeholder
  • Field content (Text Editor and HTML field types)
  • Field help
  • Field min / max attributes

Blog

Example Description Where To Use
#blog_name Returns the site title.
  • Anywhere
#blog_admin_email Returns the administration email address.
  • Anywhere
#blog_date Returns the current date using the site date format.
  • Anywhere
#blog_time Returns the current time using the site time format.
  • Anywhere

Selects, Checkboxes and Radios

Example Description Where To Use
#field(123) Returns the value of a select, checkbox or radio for field ID 123.
  • Anywhere
#select_option_text(123) Returns selected option text for field ID 123.
  • Anywhere
#checkbox_label(123) Returns the checked checkbox(es) label(s) for field ID 123.
  • Anywhere
#radio_label(123) Returns the checked radio label for field ID 123.
  • Anywhere

Query Variables

Example Description Where To Use
#query_var("post_id") Returns the value of the query variable post_id.

For example:

https://mysite.com/?post_id=123

This would return 123.

  • Client-side

Date/Time

Also see our Date/Time Cheat Sheet for more examples.

Example Description Where To Use
#client_date Returns the users web browser local date in the format configured in WordPress. This variable can only be used in client-side.
  • Client-side
#client_time Returns the users web browser local time in the format configured in WordPress. This variable can only be used in client-side.
  • Client-side
#client_date_custom(format, seconds_offset) Returns the users web browser local date and time in a specified format (PHP date format)

Learn more about date formats

  • Client-side
#blog_date Returns the blog date in the format configured in WordPress.
  • Anywhere
#blog_time Returns the blog time in the format configured in WordPress.
  • Anywhere
#blog_date_custom(format, seconds_offset) Returns the blog date and time in a specified format (PHP date format).

Learn more about date formats

  • Anywhere
#server_date Returns the server date in the format configured in WordPress.
  • Anywhere
#server_time Returns the server time in the format configured in WordPress.
  • Anywhere
#server_date_custom(format, seconds_offset) Returns the server date and time in a specified format (PHP date format).

Learn more about date formats

  • Anywhere

For a complete reference of all the available variables, click here.