P4A Field

From P4A - PHP For Applications - PHP Framework

Jump to: navigation, search

P4A_Field is a widget that allows users to input data. Every field has a type between:

  • text: a single line data input
  • date: a single line data input for dates, values are automatically formatted respecting your locale settings. This type features a nice date picker too.
  • checkbox: the name is self-explanatory
  • select: HTML combobox
  • radio: a group of HTML radio buttons
  • password: HTML input type="password"
  • file: file upload with image/audio/video preview
  • textarea: multiline data input
  • rich_textarea: multiline data input featuring rich text editing controls
  • multicheckbox: a group of checkboxes
  • multiselect: HTML combobox featuring multiple selections
  • hidden: HTML input type="hidden"
  • label: converts the field to a simple data output, user can simply read the value

How to change a field type

Use the setType method:

 
$field->setType("checkbox");
 

Sample usage

 
$this->build("p4a_field", "field")
	->setType("text") // optional, text is the default type
	->setWidth(200) // optional, fields already have a default width
	->setLabel("Field") //optional, fields already have an auto-generated label
	;
$frame->anchor($this->field);
 

Particular field types

Personal tools
Theme customizations