Methods summary
public
|
#
__construct( string $html_id, string $target = '', boolean $enable_captcha_protection = true )
Constructs a HTMLForm object
Constructs a HTMLForm object
Parameters
- $html_id
- The HTML name of the form
- $target
- The url where the form sends data
- $enable_captcha_protection
- True if the CAPTCHA is enabled
|
public
|
|
public
|
#
add_fieldset( FormFieldset $fieldset )
Adds fieldset in the form
Adds fieldset in the form
Parameters
- $fieldset
- fieldset to add
|
public
|
#
add_constraint( FormConstraint $constraint )
Adds a constraint on the form. This kind of constraints are rules regarding several fields.
Adds a constraint on the form. This kind of constraints are rules regarding several fields.
Parameters
- $constraint
- The constraint to add
|
public
|
#
add_button( FormButton $button )
Adds a button to the form
Adds a button to the form
Parameters
- $button
- The button to add
|
public
mixed
|
#
get_value( string $field_id, $default_value = null )
Returns the value of a form field.
Returns the value of a form field.
Parameters
- $field_id
- The HTML id of the field and string $default_value The default value
- $default_value
Returns
mixed The value of the field (the type depends of the field)
Throws
|
public
Boolean
|
#
field_is_disabled( string $field_id )
Returns true if field is disabled
Returns true if field is disabled
Parameters
- $field_id
- The HTML id of the field and string $default_value The default value
Returns
Boolean true if field is disabled
|
public
mixed
|
#
has_field( string $field_id )
Returns true if the $field_id is in the form.
Returns true if the $field_id is in the form.
Parameters
- $field_id
- The HTML id of the field
Returns
mixed true if the $field_id is in the form, false otherwise
|
public
|
|
public
Template
|
#
display( )
Displays the form
Returns
Template The template containing all the form elements which is ready to be displayed.
Implementation of
|
public
boolean
|
#
validate( )
Validates the form from all its constraints. If the constraints are satisfied, the
validation errors will be displayed at the top of the form.
Validates the form from all its constraints. If the constraints are satisfied, the
validation errors will be displayed at the top of the form.
Returns
boolean true if the form is valid, false otherwise
|
public
|
#
set_html_id( string $html_id )
Sets the form's HTML id
Parameters
|
public
|
|
public
|
#
set_target( string $target )
Sets the form's target
Parameters
- $target
- The URL at which the form will be submited
|
public
|
#
set_css_class( string $css_class )
Sets the form's CSS class
Sets the form's CSS class
Parameters
- $css_class
The CSS class (see the HTMLForm::SMALL_CSS_CLASS and
HTMLForm::NORMAL_CSS_CLASS constants)
|
public
|
#
set_method( string $method )
Sets the HTTP method with which the form will be submited
Sets the HTTP method with which the form will be submited
Parameters
- $method
- The method name (HTMLForm::HTTP_METHOD_POST or HTMLForm::HTTP_METHOD_POST).
|
public
|
#
set_template( Template $template )
Sets the template to use to display the form. If this method is not called,
a default template will be used (
/template/default/framework/builder/form/Form.tpl
).
Sets the template to use to display the form. If this method is not called,
a default template will be used (
/template/default/framework/builder/form/Form.tpl
).
Parameters
- $template
- The template to use
|