phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Class: Form

Source Location: /qp_inc/_core/ui/forms/_form.class.php

Class Form

Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Widget

Widget::$global_icons
Widget::$params
Widget::$title

Inherited From Widget

Widget::Widget()
Constructor
Widget::disp_template_raw()
Display a template param without replacing variables
Widget::disp_template_replaced()
Display a template param with its variables replaced
Widget::gen_global_icons()
Generate img tags for registered icons, through global_icon().
Widget::global_icon()
Registers a global action icon
Widget::replace_callback()
Callback function used to replace only necessary values in template.
Widget::replace_callback_wrapper()
This is an additional wrapper to replace_vars() that allows to react on the return value of it.
Widget::replace_vars()
Replaces $vars$ with appropriate values.

[ Top ]
Property Summary
array   $append_javascript   Additional Javascript to append to the form, in Form::end_form().
mixed   $check_all   Do we need to add javascript for check/uncheck all functionality
boolean   $disp_param_err_messages_with_fields   Display param errors with fields, appended to the note?
string   $hiddens   This is a buffer for hidden fields. We'll display all of them just before the end of form </form>. This avoids having them caught in between table rows.
array   $included_input_field_names   A list of input field names that have been used in the form.
string   $label_suffix   Suffix for LABELs.
string   $note_format   This is the default note format, where handle_common_params() falls back to, when not given with $field_params.
boolean   $output   Output HTML or just return it?
array   $saved_layouts   Stack of previous used layouts
mixed   $saved_templates  
array   $_common_params   Common params shared between methods.
array   $_opentags   Remember number of open tags that need to be handled in end_form().

[ Top ]
Method Summary
static string   get_select_options_string()   Get the OPTION list as string for use in a SELECT.
static string   get_valid_id()   Convert a given string (e.g. fieldname) to a valid HTML id.
Form   Form()   Constructor
The   begin_field()   Start an input field.
true|string   begin_fieldset()   Builds a fieldset tag. This is a fieldset element by default, but a th element for table layout.
mixed   begin_form()   Builds the form field
mixed   button()   Builds a button.
mixed   buttons()   Builds a button list.
mixed   buttons_input()   Builds a button list.
mixed   button_input()   Builds a button.
mixed   checkbox()   Builds a checkbox field
void   checkbox_basic_input()   EXPERIMENTAL: simpler method of obtaining basic checkboxes
mixed   checkbox_input()   Builds a checkbox field
mixed   checklist()   Builds a checkbox list
void   check_all()   Return links to check and uncheck all check boxes of the form
mixed   combo_box()   Combo box Display a select options list with an option 'new', and when this one is seleted, display a combo input text to add a new value
array   convert_button_to_field_params()   Convert a deprecated, numeric button array to a field_params array.
mixed   date()   Builds a date input field.
mixed   date_input()   Builds a date input field.
true|string   dayOfWeek()   Build a select to choose a weekday.
true|string   dayOfWeek_input()   Build a select to choose a weekday.
true|string   display_or_return()   Display or return, according to $output.
mixed   duration()   Builds a duration input field.
mixed   duration_input()   Builds a duration input field.
The   end_field()   End an input field.
true|string   end_fieldset()   Ends a fieldset.
true|string   end_form()   Ends the form, optionally displays buttons and closes all open fieldsets.
string   get_input_element()   Generate a general input element.
string   get_label()   Get the label of a field. This is used by begin_field() or end_field(),
void   handle_common_params()   Extract common params out of $field_params into $_common_params and unsets them in $field_params.
void   hidden()   Builds an hidden input tag, overwriting any previous hidden values (except for "foo[]").
mixed   hiddens()   Builds a list of hidden inputs.
void   hiddens_by_key()   Builds a list of hidden inputs from an array where the keys are the field names.
void   hidden_ctrl()   Add the "ctrl" param, used in the backoffice, as a hidden field.
mixed   info()   Builds an info field.
mixed   info_field()   Builds an info field.
true|string   input_field()   Generate a general input field.
mixed   password()   Builds a password input field.
mixed   password_input()   Builds a password input field.
mixed   radio()   Generate set of radio options.
mixed   radio_input()   Generate set of radio options.
mixed   select()   Display a select field and populate it with a callback function.
mixed   select_input()   Display a select field and populate it with a callback function.
mixed   select_input_array()   This is a stub for select_input_options() which builds the required list of <option> elements from a given list of options ($field_options) and the selected value ($field_value).
mixed   select_input_object()   Display a select field and populate it with a cache object by using a callback method.
mixed   select_input_options()   Display a select field and populate it with a cache object.
mixed   select_object()   Display a select field and populate it with a cache object.
mixed   select_options()   Display a select field and populate it with a cache object.
mixed   submit()   Builds a submit input tag
mixed   submit_input()   Builds a submit input tag.
void   switch_layout()  
mixed   text()   Builds a text (or password) input field.
void   textarea()   Build a text area.
void   textarea_input()   Build a text area.
true|string   text_input()   Builds a text (or password) input field.
mixed   time()   Builds a time input field.
mixed   time_input()   Builds a time input field.
void   time_select()   Builds a time select input field

[ Top ]
Properties
array   $append_javascript = array() [line 119]

Additional Javascript to append to the form, in Form::end_form().

API Tags:
Access:  protected


[ Top ]
mixed   $check_all = false [line 111]

Do we need to add javascript for check/uncheck all functionality


[ Top ]
boolean   $disp_param_err_messages_with_fields = true [line 125]

Display param errors with fields, appended to the note?


[ Top ]
string   $hiddens = array() [line 106]

This is a buffer for hidden fields. We'll display all of them just before the end of form </form>. This avoids having them caught in between table rows.


[ Top ]
array   $included_input_field_names = array() [line 141]

A list of input field names that have been used in the form.

This gets used in hiddens_by_key() to exclude those.


[ Top ]
string   $label_suffix = ':' [line 75]

Suffix for LABELs.


[ Top ]
string   $note_format = ' <span class="notes">%s</span>' [line 99]

This is the default note format, where handle_common_params() falls back to, when not given with $field_params.

Information Tags:
Todo:  This might be used in switch_layout().

[ Top ]
boolean   $output = true [line 62]

Output HTML or just return it?


[ Top ]
array   $saved_layouts [line 132]

Stack of previous used layouts

API Tags:
See:  Form::switch_layout()


[ Top ]
mixed   $saved_templates [line 133]

[ Top ]
array   $_common_params = array() [line 91]

Common params shared between methods.

These can all be used with the $field_params argument of the functions.

  • 'note': The note associated with the field.
  • 'note_format': The format of the note. %s gets replaced by the note.
  • 'label': The label for the field.
  • 'required': is the element required to be filled/checked? This will add a visual hint (boolean; default: false)

API Tags:
See:  Form::handle_common_params()
Usedby:  Form::begin_field()


[ Top ]
array   $_opentags = array( 'fieldset' => 0 ) [line 69]

Remember number of open tags that need to be handled in end_form().


[ Top ]
Methods
static method get_select_options_string  [line 1830]

  static string get_select_options_string( array $field_options, [string $field_value = NULL], [boolean $force_keys_as_values = false]  )

Get the OPTION list as string for use in a SELECT.

Parameters:
array   $field_options:  Options
string   $field_value:  Selected value (if any)
boolean   $force_keys_as_values:  Force keys from $options as values? (Default: false, only array keys, which are strings will be used).


[ Top ]
static method get_valid_id  [line 2726]

  static string get_valid_id( $id  )

Convert a given string (e.g. fieldname) to a valid HTML id.

Parameters:
   $id: 


[ Top ]
Constructor Form  [line 153]

  Form Form( [string $form_action = NULL], [string $form_name = ''], [string $form_method = 'post'], [string $layout = NULL], [string $enctype = '']  )

Constructor

Parameters:
string   $form_action:  the action destination of the form (NULL for pagenow)
string   $form_name:  the name of the form (will be used as an ID)
string   $form_method:  the method used to send data ("post" (Default), "get")
string   $layout:  the form layout : 'fieldset', 'table' or '' (NULL means: if there is an $AdminUI object get it from there, otherwise use 'fieldset')
string   $enctype:  Form encoding ("application/x-www-form-urlencoded" (default), "multipart/form-data" (uploads))


[ Top ]
begin_field  [line 385]

  The begin_field( [string $field_name = NULL], [string $field_label = NULL], [boolean $reset_common_params = false]  )

Start an input field.

A field is a fielset containing a label div and an input div.

Parameters:
string   $field_name:  The name of the field
string   $field_label:  The field label
boolean   $reset_common_params:  Reset $_common_params? This should be used if you build a field by yourself.

API Tags:
Return:  generated HTML
Uses:  Form::$_common_params


[ Top ]
begin_fieldset  [line 469]

  true|string begin_fieldset( [string $title = ''], [string $field_params = array()]  )

Builds a fieldset tag. This is a fieldset element by default, but a th element for table layout.

Parameters:
string   $title:  the title of the fieldset
string   $field_params:  the field params to the fieldset additionally 'legend_params' can be used to give an array of field params

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
begin_form  [line 1287]

  mixed begin_form( [string $form_class = NULL], [string $form_title = ''], [array $form_params = array()]  )

Builds the form field

Parameters:
string   $form_class:  the class to use for the form tag
string   $form_title:  title to display on top of the form
array   $form_params:  Additional params to the form element. See $_common_params. These may override class members.

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
button  [line 2243]

  mixed button( array $options  )

Builds a button.

You probably want to use buttons_input(), which uses $buttonsstart/$buttonsend to align the buttons properly.

The array must contain :

  • the button type
  • the name (optional)
  • the value (optional)
  • the class (optional)
  • the onclick attribute (optional)
  • the style (optional)

Parameters:
array   $options:  a two-dimension array containing the elements of the input tags

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
buttons  [line 2187]

  mixed buttons( [array $buttons = array()], boolean 1  )

Builds a button list.

Array entries with numeric (deprecated) keys are converted to their equivalent string indexes.

the two-dimension array must contain :

  • the button type
  • the name (optional)
  • the value (optional)
  • the class (optional)
  • the onclick attribute (optional)
  • the style (optional)

Parameters:
boolean   1:  to select or not the default display
array   $buttons:  a two-dimension array containing the elements of the input tags

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
buttons_input  [line 2127]

  mixed buttons_input( [array $buttons = array()]  )

Builds a button list.

The array contains an associative array for each button (params to button_input().

Parameters:
array   $buttons:  a two-dimension array containing the elements of the input tags

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
button_input  [line 2210]

  mixed button_input( [array $field_params = array()]  )

Builds a button.

You probably want to use buttons_input(), which uses $buttonsstart/$buttonsend to align the buttons properly.

Parameters:
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • type: The type attribute (string, default 'submit')

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
checkbox  [line 1234]

  mixed checkbox( string $field_name, boolean $field_checked, string $field_label, [string $field_note = ''], [string $field_class = ''], [string $field_value = 1], [boolean $field_disabled = false]  )

Builds a checkbox field

Parameters:
string   $field_name:  the name of the checkbox
boolean   $field_checked:  indicating if the checkbox must be checked
string   $field_label:  label
string   $field_note:  note
string   $field_class:  CSS class
string   $field_value:  value to use
boolean   $field_disabled:  an optional indicating whether the box is disabled or not

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
checkbox_basic_input  [line 1195]

  void checkbox_basic_input( $field_name, $field_checked, $field_label, [ $field_params = array()]  )

EXPERIMENTAL: simpler method of obtaining basic checkboxes

Parameters:
   $field_name: 
   $field_checked: 
   $field_label: 
   $field_params: 


[ Top ]
checkbox_input  [line 1167]

  mixed checkbox_input( string $field_name, boolean $field_checked, string $field_label, [array $field_params = array()]  )

Builds a checkbox field

Parameters:
string   $field_name:  the name of the checkbox
boolean   $field_checked:  indicating if the checkbox must be checked by default
string   $field_label:  label
array   $field_params:  Optional params. Additionally to $_common_params you can use: 'value': the value attribute of the checkbox (default 1)

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
checklist  [line 1486]

  mixed checklist( array $options, string $field_name, string $field_label, [boolean $required = false], [boolean $add_highlight_spans = false]  )

Builds a checkbox list

the two-dimension array must indicate, for each checkbox:

  • the name,
  • the value -- in practice this will often be just 1
  • the comment to put between <input> and
  • "effective value": a boolean indicating whether the box should be checked or not on display
  • an optional boolean indicating whether the box is disabled or not
  • an optional note
  • 'required': is the box required to be checked (boolean; default: false)

Parameters:
array   $options:  a two-dimensional array containing the parameters of the input tag
string   $field_name:  name
string   $field_label:  label
boolean   $required:  true to surround checkboxes if they are required
boolean   $add_highlight_spans:  true add a surround_check span, used by check_all mouseover

API Tags:
Return:  true (if output) or the generated HTML if not outputting

Information Tags:
Todo:  Transform to $field_params schema.

[ Top ]
check_all  [line 1263]

  void check_all( )

Return links to check and uncheck all check boxes of the form



[ Top ]
combo_box  [line 1868]

  mixed combo_box( string $field_name, string $field_value, string $field_options, string $field_label, [array $field_params = array()]  )

Combo box Display a select options list with an option 'new', and when this one is seleted, display a combo input text to add a new value

Parameters:
string   $field_name:  field name
string   $field_value:  field value
string   $field_options:  containing options
string   $field_label:  field label
array   $field_params:  Optional params

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
convert_button_to_field_params  [line 2265]

  array convert_button_to_field_params( array $options  )

Convert a deprecated, numeric button array to a field_params array.

Parameters:
array   $options:  A button array like button() and buttons() are getting.

API Tags:
Return:  The button array converted to a string indexed button array (field_params).
Deprecated:  

Information Tags:
Todo:  EdB: this is used in 3 cases in this file in v0.0.0 (EdB)

[ Top ]
date  [line 849]

  mixed date( string $field_name, string $field_value, string $field_label, [string $date_format = NULL]  )

Builds a date input field.

Parameters:
string   $field_name:  the name of the input field
string   $field_value:  initial value (ISO datetime)
string   $field_label:  label displayed in front of the field
string   $date_format:  date format (php format)

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
date_input  [line 733]

  mixed date_input( string $field_name, string $field_value, string $field_label, [array $field_params = array()]  )

Builds a date input field.

Parameters:
string   $field_name:  the name of the input field
string   $field_value:  initial value (ISO datetime (YYYY-MM-DD HH:MM:SS) or erroneous if the field is in error state)
string   $field_label:  label displayed in front of the field
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • date_format: Format of the date (string, PHP format, default taken from locale_datefmt())
  • add_date_format_note: If true, date format note gets prepended to the field's note

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
dayOfWeek  [line 1140]

  true|string dayOfWeek( $field_name, $field_value, $field_label, [ $field_note = NULL], [ $field_class = NULL]  )

Build a select to choose a weekday.

Parameters:
   $field_name: 
   $field_value: 
   $field_label: 
   $field_note: 
   $field_class: 


[ Top ]
dayOfWeek_input  [line 1114]

  true|string dayOfWeek_input( $field_name, $field_value, $field_label, [ $field_params = array()]  )

Build a select to choose a weekday.

Parameters:
   $field_name: 
   $field_value: 
   $field_label: 
   $field_params: 

API Tags:
Uses:  Form::select_input_options()


[ Top ]
display_or_return  [line 2935]

  true|string display_or_return( $r  )

Display or return, according to $output.

Parameters:
   $r: 

API Tags:
Return:  True, if we want to display, the string if not.


[ Top ]
duration  [line 1101]

  mixed duration( string $field_prefix, string $duration, string $field_label  )

Builds a duration input field.

Parameters:
string   $field_prefix:  the name of the input field
string   $duration:  initial value (seconds)
string   $field_label:  label displayed in front of the field

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
duration_input  [line 1053]

  mixed duration_input( string $field_prefix, string $duration, string $field_label, [array $field_params = array()]  )

Builds a duration input field.

Parameters:
string   $field_prefix:  the name of the input field
string   $duration:  initial value (seconds)
string   $field_label:  label displayed in front of the field
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • minutes_step ( default = 15 );

API Tags:
Return:  true (if output) or the generated HTML if not outputting

Information Tags:
Todo:  @Francois: please check API and change as appropriate.

[ Top ]
end_field  [line 439]

  The end_field( )

End an input field.

A field is a fielset containing a label div and an input div.


API Tags:
Return:  generated HTML


[ Top ]
end_fieldset  [line 547]

  true|string end_fieldset( )

Ends a fieldset.


API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
end_form  [line 1396]

  true|string end_form( [array $buttons = array()]  )

Ends the form, optionally displays buttons and closes all open fieldsets.

Parameters:
array   $buttons:  Optional array to display the buttons before the end of the form, see buttons_input()

API Tags:
Return:  true (if output) or the generated HTML if not outputting.


[ Top ]
get_input_element  [line 2668]

  string get_input_element( [array $field_params = array()], [ $parse_common = true]  )

Generate a general input element.

Parameters:
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • input_prefix: Text before <input /> (string, default '')
  • input_suffix: Text after <input /> (string, default "\n")
  • input_help: Gets used as default value on empty input (type=text) elements. It gets attached through JavaScript (onfocus, onblur and form.onsubmit).
  • format_to_output: Use format_to_output in get_field_attribs_as_string? (boolean, default True)
   $parse_common: 

API Tags:
Return:  The <input /> element.
Usedby:  Form::input_field() - to generate the <input> element


[ Top ]
get_label  [line 2743]

  string get_label( )

Get the label of a field. This is used by begin_field() or end_field(),


API Tags:
Access:  protected


[ Top ]
handle_common_params  [line 2791]

  void handle_common_params( array &$field_params, [string|NULL $field_name = NULL], [ $field_label = NULL], [ $field_note = NULL]  )

Extract common params out of $field_params into $_common_params and unsets them in $field_params.

Also handles adding errors to the note.

Parameters:
array   &$field_params:  An array passed to a field generating function like text_input(). By reference!
string|NULL   $field_name:  The name of the field. If not empty it gets used to build the id attribute.
   $field_label: 
   $field_note: 

API Tags:
Access:  protected


[ Top ]
hidden  [line 2304]

  void hidden( string $field_name, string $field_value, [array $field_params = array()]  )

Builds an hidden input tag, overwriting any previous hidden values (except for "foo[]").

This generates no output and returns nothing: the hidden fields get added to $hiddens, and get appended to the end of the form.

Parameters:
string   $field_name:  Field name
string   $field_value:  Field value
array   $field_params:  Optional params. This is e.g. useful for "id". See $_common_params.

API Tags:
Usedby:  Form::hiddens_by_key()


[ Top ]
hiddens  [line 2363]

  mixed hiddens( array $hiddens  )

Builds a list of hidden inputs.

Parameters:
array   $hiddens:  Array of parameters to hidden():
  • 0: field_name
  • 1: field_value
  • 2: field_params

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
hiddens_by_key  [line 2384]

  void hiddens_by_key( array $hiddens, [array|NULL $exclude = NULL]  )

Builds a list of hidden inputs from an array where the keys are the field names.

It supports array values (one-dimensional) and generates appropriate key-value pairs.

Parameters:
array   $hiddens:  associative array ( name => value ) of hidden fields.
array|NULL   $exclude:  A list of keys to ignore, in addition to $included_input_field_names.

API Tags:
Uses:  Form::hidden()


[ Top ]
hidden_ctrl  [line 2344]

  void hidden_ctrl( )

Add the "ctrl" param, used in the backoffice, as a hidden field.



[ Top ]
info  [line 2109]

  mixed info( string $field_label, string $field_info, [string $field_note = NULL], [ $format = 'htmlbody']  )

Builds an info field.

An info field is a fieldset containing a label div and an info div.

Parameters:
string   $field_label:  the field label
string   $field_info:  the field info
string   $field_note:  see format_to_output()
   $format: 

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
info_field  [line 2033]

  mixed info_field( string $field_label, string $field_info, [array $field_params = array()]  )

Builds an info field.

An info field is a fieldset containing a label div and an info div.

Parameters:
string   $field_label:  the field label
string   $field_info:  the field info
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • 'format_info': Format of info content, see format_to_output() (string, default 'htmlbody')

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
input_field  [line 2643]

  true|string input_field( [array $field_params = array()]  )

Generate a general input field.

This is the base function for text_input(), checkbox_input(), ..

Parameters:
array   $field_params:  Optional params. Additionally to $_common_params you can use:

API Tags:
Return:  true (if output) or the generated HTML if not outputting
Uses:  Form::get_input_element() - to generate the <input> element


[ Top ]
password  [line 703]

  mixed password( string $field_name, string $field_value, integer $field_size, string $field_label, [string $field_note = ''], [integer $field_maxlength = 0], [string $field_class = '']  )

Builds a password input field.

Calls the text() method with a 'password' parameter.

Parameters:
string   $field_name:  the name of the input field
string   $field_value:  initial value
integer   $field_size:  size of the input field
string   $field_label:  label displayed in front of the field
string   $field_note:  note displayed with field
integer   $field_maxlength:  max length of the value (if 0 field_size will be used!)
string   $field_class:  the CSS class to use

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
password_input  [line 681]

  mixed password_input( string $field_name, string $field_value, integer $field_size, string $field_label, [string $field_params = array()], integer 5, string 6  )

Builds a password input field.

Calls the text_input() method with type == 'password'.

Parameters:
integer   5:  Max length of the value (if 0 field_size will be used!)
string   6:  Extended attributes, see text_input().
string   $field_name:  The name of the input field. This gets used for id also, if no id given in $field_params.
string   $field_value:  Initial value
integer   $field_size:  Size of the input field
string   $field_label:  Label displayed in front of the field
string   $field_params:  Note displayed with field

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
radio  [line 2596]

  mixed radio( string $field_name, string $field_value, array $field_options, string $field_label, [boolean $field_lines = false], [string $field_note = '']  )

Generate set of radio options.

Parameters:
string   $field_name:  the name of the radio options
string   $field_value:  the checked option
array   $field_options:  of arrays the radio options (0: value, 1: label, 2: notes, 3: additional HTML [input field, ..], 4: attribs for <input tag> )
string   $field_label:  label
boolean   $field_lines:  options on seperate lines (DIVs)
string   $field_note:  notes

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
radio_input  [line 2497]

  mixed radio_input( string $field_name, string $field_value, array $field_options, string $field_label, [array $field_params = array()]  )

Generate set of radio options.

Parameters:
string   $field_name:  The name of the radio options
string   $field_value:  The checked option's value
array   $field_options:  of arrays The radio options Keys:
  • 'value' (required)
  • 'label' (required)
  • 'note'
  • 'type' (default: "radio")
  • 'class' (default: "radio")
  • 'checked' (default: 'value' gets compared to $field_value)
  • 'name' (default: $field_name)
  • 'suffix' (gets used after the radio's label)
  • Plus everything for get_input_element() )
string   $field_label:  Label
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • lines: Options on seperate lines (DIVs) (boolean, default false)
NOTE: these params/attribs get used as default for every INPUT field, overridden by $field_options

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
select  [line 1588]

  mixed select( string $field_name, string $field_value, callback $field_list_callback, string $field_label, [string $field_note = ''], [string $field_class = ''], [string $field_onchange = NULL]  )

Display a select field and populate it with a callback function.

Parameters:
string   $field_name:  field name
string   $field_value:  default field value
callback   $field_list_callback:  callback function
string   $field_label:  field label to be display before the field
string   $field_note:  note to be displayed after the field
string   $field_class:  CSS class for select
string   $field_onchange:  Javascript to add for onchange event (trailing ";").

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
select_input  [line 1568]

  mixed select_input( string $field_name, string $field_value, callback $field_list_callback, string $field_label, [array $field_params = array()]  )

Display a select field and populate it with a callback function.

Parameters:
string   $field_name:  field name
string   $field_value:  default field value
callback   $field_list_callback:  callback function
string   $field_label:  field label to be display before the field
array   $field_params:  Optional params. Additionally to $_common_params you can use: Nothing yet.

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
select_input_array  [line 1802]

  mixed select_input_array( string $field_name, mixed $field_value, array $field_options, string $field_label, [string $field_note = NULL], [array $field_params = array()]  )

This is a stub for select_input_options() which builds the required list of <option> elements from a given list of options ($field_options) and the selected value ($field_value).

Parameters:
string   $field_name:  field name
mixed   $field_value:  Initial value
array   $field_options:  Options. If an associative key (string) is used, this gets the value attribute. NOTE: numeric strings get converted to integers by PHP!
string   $field_label:  Field label to be display before the field
string   $field_note:  Note
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • 'force_keys_as_values': Use the key of $field_options for "value" attrib always.
  • Plus all of select_input_options().

API Tags:
Return:  true (if output) or the generated HTML if not outputting
Uses:  Form::select_input_options()


[ Top ]
select_input_object  [line 1630]

  mixed select_input_object( string $field_name, string $field_value, DataObjectCache &$field_object, string $field_label, [array $field_params = array()]  )

Display a select field and populate it with a cache object by using a callback method.

Parameters:
string   $field_name:  Field name
string   $field_value:  Default field value
DataObjectCache   &$field_object:  Cache containing values for list
string   $field_label:  Field label to be display with the field
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • 'allow_none': allow to select [none] in list (boolean, default false)
  • 'object_callback': Object's callback method name (string, default 'get_option_list')
  • 'loop_object_method': The method on the objects inside the callback (string, default NULL)

API Tags:
Return:  true (if output) or the generated HTML if not outputting
Usedby:  Form::select_object()
Uses:  Form::select_input_options()


[ Top ]
select_input_options  [line 1725]

  mixed select_input_options( string $field_name, string $field_options, string $field_label, [string $field_note = ''], [array $field_params = array()]  )

Display a select field and populate it with a cache object.

Parameters:
string   $field_name:  field name
string   $field_options:  string containing options '<option>...</option>'
string   $field_label:  field label to be display before the field
string   $field_note:  "help" note (Should provide something useful, otherwise leave it empty)
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • 'label': Field label to be display before the field
  • 'class': CSS class for select

API Tags:
Return:  true (if output) or the generated HTML if not outputting
Usedby:  Form::select_input_array()
Usedby:  Form::select_options()
Usedby:  Form::select_input_object()
Usedby:  Form::dayOfWeek_input()


[ Top ]
select_object  [line 1691]

  mixed select_object( string $field_name, string $field_value, DataObjectCache &$field_object, string $field_label, [string $field_note = ''], [boolean $allow_none = false], [string $field_class = ''], [string $field_object_callback = 'get_option_list'], [string $field_onchange = NULL]  )

Display a select field and populate it with a cache object.

Parameters:
string   $field_name:  field name
string   $field_value:  default field value
DataObjectCache   &$field_object:  Cache containing values for list
string   $field_label:  field label to be display before the field
string   $field_note:  note to be displayed after the field
boolean   $allow_none:  allow to select [none] in list
string   $field_class:  CSS class for select
string   $field_object_callback:  Object's callback method name.
string   $field_onchange:  Javascript to add for onchange event (trailing ";").

API Tags:
Return:  true (if output) or the generated HTML if not outputting
Uses:  Form::select_input_object()


[ Top ]
select_options  [line 1767]

  mixed select_options( string $field_name, string $field_options, string $field_label, [string $field_note = NULL], [string $field_class = NULL], [string $field_onchange = NULL]  )

Display a select field and populate it with a cache object.

Parameters:
string   $field_name:  field name
string   $field_options:  string containing options
string   $field_label:  field label to be display before the field
string   $field_note:  note to be displayed after the field
string   $field_class:  CSS class for select
string   $field_onchange:  Javascript to add for onchange event (trailing ";").

API Tags:
Return:  true (if output) or the generated HTML if not outputting
Uses:  Form::select_input_options()


[ Top ]
submit  [line 2467]

  mixed submit( array $options  )

Builds a submit input tag

You probably want to use buttons_input(), which uses $buttonsstart/$buttonsend to align the buttons properly.

the array must contain :

  • the name (optional)
  • the value (optional)
  • the class (optional)
  • the onclick attribute (optional)
  • the style (optional)

Parameters:
array   $options:  an array containing the elements of the input tags

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
submit_input  [line 2444]

  mixed submit_input( [array $field_params = array()]  )

Builds a submit input tag.

You probably want to use buttons_input(), which uses $buttonsstart/$buttonsend to align the buttons properly.

the array must contain :

  • the name (optional)
  • the value (optional)
  • the class (optional)
  • the onclick attribute (optional)
  • the style (optional)

Parameters:
array   $field_params:  Optional params. See $_common_params.

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
switch_layout  [line 228]

  void switch_layout( string|NULL $layout  )

Parameters:
string|NULL   $layout:  the form layout : 'fieldset', 'table' or ''; NULL to restore previsouly saved layout


[ Top ]
text  [line 641]

  mixed text( string $field_name, string $field_value, integer $field_size, string $field_label, [string $field_note = ''], [integer $field_maxlength = 0], [string $field_class = ''], [string $inputtype = 'text'], [ $force_to = '']  )

Builds a text (or password) input field.

Note: please use Form::password() for password fields

Parameters:
string   $field_name:  the name of the input field
string   $field_value:  initial value
integer   $field_size:  size of the input field
string   $field_label:  label displayed in front of the field
string   $field_note:  note displayed with field
integer   $field_maxlength:  max length of the value (if 0 field_size will be used!)
string   $field_class:  the CSS class to use
string   $inputtype:  input type (only 'text' or 'password' makes sense)
   $force_to: 

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
textarea  [line 2007]

  void textarea( string $field_name, string $field_value, integer $field_rows, string $field_label, [string $field_note = ''], [integer $field_cols = 50], [string $field_class = '']  )

Build a text area.

Parameters:
string   $field_name: 
string   $field_value: 
integer   $field_rows: 
string   $field_label: 
string   $field_note: 
integer   $field_cols: 
string   $field_class: 

API Tags:
Uses:  Form::textarea_input()


[ Top ]
textarea_input  [line 1940]

  void textarea_input( string $field_name, string $field_value, integer $field_rows, string $field_label, [array $field_params = array()]  )

Build a text area.

Parameters:
string   $field_name:  Name of the field
string   $field_value:  Value of the field
integer   $field_rows:  Number of rows
string   $field_label:  Label for the field
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • 'cols': Number of columns (integer, default 50)

API Tags:
Usedby:  Form::textarea()


[ Top ]
text_input  [line 582]

  true|string text_input( string $field_name, string $field_value, integer $field_size, string $field_label, [string $field_note = ''], [array $field_params = array()]  )

Builds a text (or password) input field.

Note: please use Form::password_input() for password fields.

Parameters:
string   $field_name:  The name of the input field. This gets used for id also, if no id given in $field_params.
string   $field_value:  Initial value
integer   $field_size:  Size of the input field
string   $field_label:  Label displayed with the field
string   $field_note:  "help" note (Should provide something useful, otherwise leave it empty)
array   $field_params:  Extended attributes/params.
  • 'maxlength': if not set, $field_size gets used (use '' to disable it)
  • 'class': the CSS class to use for the <input> element
  • 'type': 'text', 'password' (defaults to 'text')
  • 'force_to': 'UpperCase' (JS onchange handler)
  • NOTE: any other attributes will be used as is (onchange, onkeyup, id, ..).

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
time  [line 902]

  mixed time( string $field_name, string $field_value, string $field_label, [ $field_format = 'hh:mm:ss'], [ $note = NULL]  )

Builds a time input field.

Parameters:
string   $field_name:  the name of the input field
string   $field_value:  initial value (ISO datetime)
string   $field_label:  label displayed in front of the field
   $field_format: 
   $note: 

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
time_input  [line 867]

  mixed time_input( string $field_name, string $field_value, string $field_label, [array $field_params = array()]  )

Builds a time input field.

Parameters:
string   $field_name:  The name of the input field
string   $field_value:  Initial value (ISO datetime)
string   $field_label:  Label displayed in front of the field
array   $field_params:  Optional params. Additionally to $_common_params you can use:
  • 'time_format': Format of the time (string, default 'hh:mm:ss')

API Tags:
Return:  true (if output) or the generated HTML if not outputting


[ Top ]
time_select  [line 924]

  void time_select( string $field_name, [string $field_value = NULL], [string $precision = '5mn'], string $field_label, [string $field_note = NULL], [string $field_class = NULL], [string $field_onchange = NULL]  )

Builds a time select input field

Parameters:
string   $field_name:  field name
string   $field_value:  initial value (ISO datetime or time only)
string   $precision:  precison xmn or xsec (x:integer) for the options minutes or secondes
string   $field_label:  field label to be display before the field
string   $field_note:  note to be displayed after the field
string   $field_class:  CSS class for select
string   $field_onchange:  Javascript to add for onchange event (trailing ";").


[ Top ]