Form Object

Contents

Introduction

The Form Object is the main object in Gravity Forms. It contains all properties of a particular form (i.e. form title, fields, notification, scheduling, etc...). This object is available to most of the Gravity Forms hooks.

It is formatted as an associative array (i.e. $form["title"] retrieves the form title).

Usage

$form["title"]                  //returns the form title
$form["fields"][0]["type"];     //returns the type of the first field of the form


Properties

Basic Properties

  • id
    (int) The form Id.
  • title
    (string) The form title
  • description
    (string) The form description
  • labelPlacement
    (string) Determines if the field labels are displayed on top of the fields (top_label), besides the fields and aligned to the left (left_label) or besides the fields and aligned to the right (right_label)
    Possible values: top_label, left_label, right_label
  • descriptionPlacement
    (string) Determines if the field description is displayed above the field input (i.e. immediately after the field label) or below the field input.
    Possible values: above, below
    Note: This setting is only available when labelPlacement is set to "top_label". When labelPlacement is not "top_label", this setting will always be set to "below".
  • fields
    (Array) List of all fields that belong to the form

Post Related

  • useCurrentUserAsAuthor
    (bool) For forms with Post fields, this determines if the post should be created using the current logged in user as the author. 1 to use the current user, 0 otherwise.
  • postAuthor
    (int) When useCurrentUserAsAuthor is set to 0, this property contains the user Id that will be used as the Post author.
  • postCategory
    (int) Form forms with Post fields, but without a Post Category field, this property determines the default category that the post will be associated with when created.
  • postContentTemplate
    (string) Template to be used when creating the post content. Field variables (i.e. {Name:3} ) can be added to the template to insert user submitted values into the post content. Only applicable when postContentTemplateEnabled is true
  • postContentTemplateEnabled
    (bool) Determines if the post template functionality is enabled. When enabled, the post content will be created based on the template specified by postContentTemplate.
  • postFormat
    (string) For forms with Post fields, determines the format that the Post should be created with.
    Possible values: Will vary depending on the formats supported by the current theme.
  • postStatus
    (string) For forms with Post fields, determines the status that the Post should be created with.
    Possible values: draft, pending, publish
  • postTitleTemplate
    (string) Template to be used when creating the post title. Field variables (i.e. {Name:3} ) can be added to the template to insert user submitted values into the post title. Only applicable when postTitleTemplateEnabled is true
  • postTitleTemplateEnabled
    (bool) Determines if the post title template functionality is enabled. When enabled, the post title will be created based on the template specified by postTitleTemplate.

Form Submission

  • confirmation
    (Array) Contains the form confirmation settings such as confirmation text or redirect URL
  • notification
    (Array) Contains all admin notification settings such as the destination email address, subject and message body.
  • autoResponder
    (Array) Contains all user notification settings such as the destination email field, subject and message body.

Advanced Properties

  • button
    (Array) Contains the form button settings such as the button text or image button source.
  • cssClass
    (string) Custom CSS class. This class will be added to the <form> tag.
  • enableAnimation
    (bool) When enabled, conditional logic hide/show operation will be performed with a jQuery slide animation. Only applicable to forms with conditional logic.
  • enableHoneypot
    (bool) Specifies if the form has the Honeypot spam-protection feature
  • limitEntries
    (bool) Specifies if this form has a limit on the number of submissions. 1 if the form limits submissions, 0 otherwise.
  • limitEntriesCount
    (int) When limitEntries is set to 1, this property specifies the number of submissions allowed.
  • limitEntriesMessage
    (string) Message that will be displayed when the maximum number of submissions have been reached
  • scheduleForm
    (bool) Specifies if this form is scheduled to be displayed only during a certain configured date/time
  • scheduleStart
    (string) Date in the format (mm/dd/yyyy) that the form will become active/visible
  • scheduleStartHour
    (int) Hour (1 to 12) that the form will become active/visible
  • scheduleStartMinute
    (int) Minute that the form will become active/visible
  • scheduleStartAmpm
    (string) "am" or "pm". Applies to scheduleStartHour
  • scheduleEnd
    (string) Date in the format (mm/dd/yyyy) that the form will become inactive/hidden
  • scheduleEndHour
    (int) Hour (1 to 12) that the form will become inactive/hidden
  • scheduleEndMinute
    (int) Minute that the form will become inactive/hidden
  • scheduleEndAmpm
    (string) "am" or "pm". Applies to scheduleEndHour
  • scheduleMessage
    (string) Message to be displayed when form is inactive

Search the Documentation