The form object
The form
object is used within the form tag. It contains attributes of its parent form.
form.address1
Anchor link to section titled "form.address1"Returns the first address line associated with the address. Exclusive to form
tags with the "address" parameter.
form.address2
Anchor link to section titled "form.address2"Returns the second address line associated with the address, if it exists. Exclusive to form
tags with the "address" parameter.
form.author
Anchor link to section titled "form.author"Returns the name of the author of the blog article comment. Exclusive to form
tags with the "article" parameter.
Returns the content of the blog article comment. Exclusive to form
tags with the "article" parameter.
Returns the city associated with the address. Exclusive to form
tags with the "address" parameter.
form.company
Anchor link to section titled "form.company"Returns the company name associated with the address, if it exists. Exclusive to form
tags with the "address" parameter.
form.country
Anchor link to section titled "form.country"Returns the country associated with the address. Exclusive to form
tags with the "address" parameter.
Returns the email of the blog article comment's author. Exclusive to form
tags with the "article" parameter.
form.errors
Anchor link to section titled "form.errors"Returns an array of strings if the form was not submitted successfully. The strings returned depend on which fields are required for the form
type. Possible values are:
author
: for required name fields, such as blog commentsbody
: for text content of messages, such as a contact formemail
: for required email fieldspassword
: for required password fieldsform
: used as a general error in cases where a more specific error cannot be provided
You can apply the default_errors filter on form.errors
to output default error messages without having to loop through the array.
form messages
and translated fields
Anchor link to section titled "form messages and translated fields"You can loop through the form.messages
and form.translated_fields
arrays to get more information about the returned form.errors
object. You can target a specific array element of either array by using an error
object of form.errors
as a key.
The messages
array holds the translated error messages for values in form.errors
.
The translated_fields
array holds translated field names for values in form.errors
.
form.first_name
Anchor link to section titled "form.first_name"Returns the first name associated with the address. Exclusive to form
tags with the "address" parameter.
Returns the id (unique identifier) of the form.
form.last_name
Anchor link to section titled "form.last_name"Returns the last name associated with the address. Exclusive to form
tags with the "address" parameter.
form.password_needed
Anchor link to section titled "form.password_needed"Used only for form
tags with the "customer_login" parameter. The form.password_needed
attribute always returns true
.
Returns the telephone number associated with the address, if it exists. Exclusive to form
tags with the "address" parameter.
form.posted_successfully?
Anchor link to section titled "form.posted_successfully?"Returns true
if the form was submitted successfully, or false
if the form contained errors. All forms but the address form set that property. The address form is always submitted successfully.
form.province
Anchor link to section titled "form.province"Returns the province or state associated with the address. Exclusive to form
tags with the "address" parameter.
form.set_as_default_checkbox
Anchor link to section titled "form.set_as_default_checkbox"Renders an HTML checkbox that can submit the current form as the customer's default address. Exclusive to form
tags with the "address" parameter.
Returns the zip code or postal code associated with the address. Exclusive to form
tags with the "address" parameter.