Cycles all fields and calls their accept_submit method
API Tags:
Adds field to the form
Please note that if the field is Form_Field_File type, encoding of the form will be automatically changed to Form::ENCODING_MULTIPART (that way form will be submited correctly)
Parameters:
API Tags:
Information Tags:
| Throws: | TE_Form_Field_Already_Exists |
Performs value check on all fields
Cycles all fields and call theirs basic_check method
API Tags:
void capture_submit(
Context
$context
)
|
|
Transfers values from $_POST or $_GET into html_value ofd each field
Parameters:
API Tags:
Creates submit event with capture specified by $submit_name
Parameters:
API Tags:
Form __construct(
string
$name, string
$action, [integer
$method = Tangra_Form_Submit_Method::POST], [integer
$enctype = Form::ENCODING_APPLICATION]
)
|
|
Constructor
Parameters:
|
string |
$name: |
Name of the form |
|
string |
$action: |
Action page |
|
integer |
$method: |
Tangra_Form_Submit_Method::POST or Tangra_Form_Submit_Method::GET |
|
integer |
$enctype: |
Form::ENCODING_APPLICATION or Form::ENCODING_MULTIPART |
Redefined in descendants as:
Gets action property of the form
API Tags:
Gets encoding type
API Tags:
Returns field specified by $field_name
Parameters:
|
string |
$field_name: |
name of the field |
API Tags:
Information Tags:
| Throws: | TE_Form_Field_Not_Exists |
Returns array containing all fields.
API Tags:
unknown get_field_html_value(
unknown_type
$field_name
)
|
|
Gets field HTML value
HTML value is value of the field as sent by HTTP POST/GET. It is not intended to be called directly by the user except in vary rare and specific circumstances.
Parameters:
|
unknown_type |
$field_name: |
|
API Tags:
Information Tags:
| Throws: | TE_Form_Field_Not_Exists |
mixed get_field_value(
string
$field_name
)
|
|
Gets Field value
Parameters:
|
string |
$field_name: |
Name of the field |
API Tags:
Information Tags:
| Throws: | TE_Form_Field_Not_Exists |
Gets method of form submission.
Returned value will Tangra_Form_Submit_Method::POST or Tangra_Form_Submit_Method::GET
API Tags:
Returns event of form submission
API Tags:
arrray get_submit_events(
)
|
|
Returns events of form submission both for <input type="submit" and <input type="image"
API Tags:
| Return: | Simple array of Web_Event_Simple elements |
| Access: | public |
string get_submit_name(
)
|
|
Returns name of the submit button
Name of the submit button contains form name and "_submit" suffix
API Tags:
string get_submit_x_name(
)
|
|
Returns name of the submit button with "_x" suffix
When submit button is image, browsers return submit name plus _x and _y suffixes (position of the click in the image)
API Tags:
string get_submit_y_name(
)
|
|
Returns name of the submit button with "_y" suffix
When submit button is image, browsers return submit name plus _x and _y suffixes (position of the click in the image)
API Tags:
Returns status of the form
Status of the form is the state of the last submission. If all fields are OK then status is true, otherwise - false
API Tags:
boolean is_receiving_submit(
Context
$context
)
|
|
Checks if form is receiving submit, i.e. submit_name is present in $_POST or $_GET
Parameters:
API Tags:
void set_enctype(
integer
$enctype
)
|
|
Sets encoding type.
Must be either Form::ENCODING_APPLICATION or Form::ENCODING_MULTIPART
Parameters:
API Tags:
| Internal: | |
| Access: | protected |
Information Tags:
void set_field_error(
string
$field_name, string
$potential_error_name
)
|
|
Sets field error.
Each form field may have potential errors. Most of them are built-in, for example - 'mandatory_missing" which means that field is mandatory, but POST/GET does not contain value for it. Each field may have custom errors that are not set during basic_check. In this case, if error condition is true, application have to call set_field_error to tell the field that it is in error.
Parameters:
|
string |
$field_name: |
Name of the field |
|
string |
$potential_error_name: |
Name of the error |
API Tags:
void set_field_value(
string
$field_name, mixed
$value
)
|
|
Sets value of form fiels
Parameters:
|
string |
$field_name: |
Name of the field |
|
mixed |
$value: |
Value of the field |
API Tags:
Information Tags:
| Throws: | TE_Form_Field_Not_Exists |
void set_method(
integer
$method
)
|
|
Sets the method of submission
Must be either Tangra_Form_Submit_Method::POST or Tangra_Form_Submit_Method::GET
Parameters:
API Tags:
| Internal: | |
| Access: | protected |
Information Tags:
void set_name(
string
$name
)
|
|
Sets the name of the form
Name of the form must be alphanumeric (underscore is allowed), starting with letter, 50 characters max. Please note that $name will be converted to lowercase.
Parameters:
API Tags:
| Internal: | |
| Access: | protected |
Information Tags:
void translate_values_html2app(
)
|
|
Translates HTML values of the fields to "application" values.
API Tags: