Field reference

Basic inputs

Text field

Pancake::text($name[, $fieldOptions])

Text <input> field.

paragraphClasses

field, text

../_images/field-text.png

Textarea

Pancake::textarea($name, $cols, $rows[, $fieldOptions])

<textarea> field.

Parameters:
  • cols (int) – HTML cols attribute.
  • disabled (bool) – HTML disabled attribute.
  • name (str) – HTML name attribute.
  • readonly (bool) – HTML readonly attribute.
  • rows (int) – HTML rows attribute.
validation

HasLinkCount (See Security for more information.)

paragraphClasses

field, textarea

../_images/field-textarea.png

Checkbox

Pancake::checkbox($name[, $fieldOptions])

Checkbox <input> field.

validation

IsCheckbox

paragraphClasses

field, checkbox

../_images/field-checkbox.png

Submit button

Pancake::submit($name, $value[, $fieldOptions])

Submit <input> button.

Note

Submit buttons are automatically used as form identifiers.

paragraphClasses

submit

../_images/field-submit.png

File upload

Pancake::fileUpload($name[, $fieldOptions])

File upload <input> field.

This field requires the FileUpload hook to process file uploads after the form is submitted. You also need to ensure that your form’s encoding type is set to multipart/form-data in order to accept file uploads (See Forms for more information).

Parameters:
  • show_upload_message (bool) – Whether or not to show the upload message. Defaults to true.
  • upload_message (str) – Message to show the user when he/she has already uploaded a file.
  • upload_to (str) – Directory to which to upload the files. Defaults to /upload.
  • upload_to_temp (str) – Directory to which to upload the temporary files. Defaults to /upload/temp.
  • valid_types (arr) – Valid file MIME types. Either an array of explicit MIME types or a pre-defined MIME-type group.
validation

IsMIMEType

paragraphClasses

field, file-upload

../_images/field-file-upload.png

How a file upload works

File uploads work in three steps:

  1. The file is uploaded to a temporary directory in order to preserve the uploaded file if the form needs to be re-submitted in order to pass validation. In order to avoid potential naming conflicts, each file name is prefixed with a number which increments until the generated file name is unique.
  2. The temporary file is used to perform any specified validations.
  3. The FileUpload hook moves the file out of the temporary directory into the permanent directory.

Mime-type groups

fileUpload() includes pre-defined MIME-type groups as a convenience to refer to a document type without individually specifying a plethora of MIME types:

audio
  • audio/mpeg
document
  • application/msword
  • application/pdf
  • application/rtf
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • application/vnd.ms-office
  • application/zip
  • text/plain
  • text/rtf
images
  • image/bmp
  • image/gif
  • image/jpeg
  • image/png
video
  • video/quicktime
  • video/mpeg

Hidden input

Pancake::hidden($name[, $fieldOptions])

Hidden <input> field. This field automatically sets the options paragraph and show_label to false.

Generic input

Pancake::input($name, $type[, $fieldOptions])

Generic <input> field.

Parameters:
  • accept (str) – HTML accept attribute.
  • alt (str) – HTML alt attribute.
  • checked (str) – HTML checked attribute.
  • disabled (str) – HTML disabled attribute.
  • maxlength (str) – HTML maxlength attribute.
  • readonly (str) – HTML readonly attribute.
  • size (str) – HTML size attribute.
  • src (str) – HTML src attribute.
  • type (str) – HTML type attribute.
  • usemap (str) – HTML usemap attribute.
  • value (str) – HTML value attribute.
paragraphClasses

field

Dates

Date text fields

Pancake::date($name[, $fieldOptions])

Three text <input> boxes for the day, month, and year.

Parameters:
  • container (str) – HTML tag for the group container. Defaults to div.
  • date_format (str) – Date format for the formatted value. Defaults to l, j F Y.
  • label_element (str) – HTML tag for the group label. Defaults to h3.
validation

IsDate

paragraphClasses

field, date

../_images/field-date-text.png

Date select drop-downs

Pancake::dateDropDowns($name[, $fieldOptions])

Three <select> drop downs for the day, month, and year.

Parameters:
  • container (str) – HTML tag for the group container. Defaults to div.
  • date_format (str) – Date format for the formatted value. Defaults to l, j F Y.
  • label_element (str) – HTML tag for the group label. Defaults to h3.
  • year_end (str) – End year, run through strtotime(). Defaults to +5 years.
  • year_start (str) –

    Start year, run through strtotime(). Defaults to -5 years.

validation

IsDate

paragraphClasses

field, date, date-drop-downs

../_images/field-date-selects.png

Date calendar

Pancake::dateCalendar($name[, $fieldOptions])

Date calendar <input> field.

Note

The automatic pop-up calendar requires Pancake’s Static media.

Parameters:date_format (str) – Date format for the formatted value. Defaults to l, j F Y.
validation

IsDate

paragraphClasses

field, date, text, calendar

../_images/field-date-calendar.png

Date estimation

Pancake::dateEstimation($name[, $fieldOptions])

Two <select> drop downs for semester and year.

Parameters:
  • container (str) – HTML tag for the group container. Defaults to div.
  • label_element (str) – HTML tag for the group label. Defaults to h3.
  • year_end (str) –

    End year, run through strtotime(). Defaults to +5 years.

  • year_start (str) –

    Start year, run through strtotime(). Defaults to -5 years.

validation

MatchesPattern for the pattern #([A-Za-z]+) (\d{4})#.

paragraphClasses

field, date, date-drop-downs

../_images/field-date-estimation.png

Lists

Checkbox list

Pancake::checkboxList($name, $options[, $fieldOptions])

Checkbox <input> list field.

Parameters:
  • container (str) – HTML tag for the group container. Defaults to div.
  • label_element (str) – HTML tag for the group label. Defaults to h3.
  • options (arr) – List of possible options. The string other becomes a text <input> field.
validation

IsOneOf

paragraphClasses

field, list, checkbox-list

../_images/field-list-checkboxes.png

Radio-button list

Pancake::radioList($name, $options[, $fieldOptions])

Radio button <input> list field.

Parameters:
  • container (str) – HTML tag for the group container. Defaults to div.
  • label_element (str) – HTML tag for the group label. Defaults to h3.
  • options (arr) – List of possible options. The string other becomes a text <input> field.
validation

IsOneOf

paragraphClasses

field, list, radio-list

../_images/field-list-radios.png

Select drop-downs

Pancake::select($name, $options[, $fieldOptions])

Drop-down <select> box field.

Parameters:
  • disabled (str) – HTML disabled attribute.
  • include_blank (bool) – Whether or not to include a blank <option>. Defaults to true.
  • multiple (str) – HTML multiple attribute.
  • options (arr) – List of possible options.
  • size (str) – HTML size attribute.
validation

IsOneOf

paragraphClasses

field, select

../_images/field-select.png

Ranking list

Pancake::ranking($name, $options[, $fieldOptions])

List of rank-able text <input> fields.

Parameters:
  • container (str) – HTML tag for the group container. Defaults to div.
  • label_element (str) – HTML tag for the group label. Defaults to h3.
  • options (arr) – List of possible options.
  • rank_up_to (int) – Number up to which the user must rank the values. Defaults to the total number of options.
validation

IsRanked

paragraphClasses

field, list, ranking

../_images/field-list-ranking.png

Specialised inputs

Email address

Pancake::email($name[, $fieldOptions])

Email address <input> field.

validation

IsEmail

paragraphClasses

field, text, email

../_images/field-email.png

Phone number

Pancake::phone($name[, $fieldOptions])

Phone number <input> field.

validation

IsPhoneNumber

paragraphClasses

field, text, phone

../_images/field-phone-number.png

Postal code

Pancake::postalCode($name[, $fieldOptions])

US and Canadian postal code <input> field.

validation

IsPostalCode

paragraphClasses

field, text, postal-code

../_images/field-postal-code.png

US state

Pancake::states($name[, $fieldOptions])

US states and Canadian provinces <select> drop-down field.

Parameters:include_blank (bool) – Whether or not to include a blank <option>. Defaults to true.
validation

IsOneOf

paragraphClasses

field, select, states

../_images/field-states.png