Public Method Details |
form_element |
public void form_element( array $element_data, int $method, [ string $form_name, string $js_mode ] )
|
|
Creates a new form element.
The form object uses this constructor to setup any form element.Derived constructurs are not called by the form object. If you needsome kind of setup in any of the derived form element classes overridesetup(). Setup() gets always called by form_element().
|
Parameter |
|
array |
$element_data |
|
|
Array describing the form element |
|
|
int |
$method |
|
|
erpreted as "GET". |
|
|
string |
$form_name |
= >>""<< |
|
HTML name attribute of the form tag. |
|
|
string |
$js_mode |
= >>""<< |
|
Optional, JavaScript validation mode. If set to
"strong" (case insensitive) each element gets checked
when changed (onChange/onClick) and when the form gets submitted (onSubmit).
All other values start JavaScript validation with "onSubmit". |
|
Returns |
void |
|
getValue |
public mixed getValue( )
|
|
Returns the value of an element.
|
Returns |
mixed $value |
|
getType |
public string getType( )
|
|
Returns the type of this element.
|
Returns |
string $type |
|
isButton |
public boolean isButton( )
|
|
Returns true if the element is a button, otherwise false
|
Returns |
boolean $is_button |
|
getValidator |
public string getValidator( )
|
|
Returns the name of the custom validation function.
|
Returns |
string $validator |
See Also |
setValidator() |
|
setValidator |
public boolean setValidator( string $validator )
|
|
Sets the name of the custom validation function.
|
Parameter |
|
|
Returns |
boolean $ok |
Throws |
form_error |
See Also |
getValidator() |
|
freeze |
public void freeze( )
|
|
Freeze the form element.
|
Returns |
void |
|
unfreeze |
public void unfreeze( )
|
|
Thaw out the object
|
Returns |
void |
|
get |
public abstract string get( [ string $value ] )
|
|
Returns the HTML code of the element.
|
Parameter |
|
string |
$value |
= >>""<< |
|
The value is only used with radio buttons.
If the given value is equal to the value of the
element when it was defined, the radio gets selected. |
|
Returns |
string $html HTML code of the element. |
See Also |
getfrozen(), show() |
|
validate |
public abstract string validate( )
|
|
Returns the result of the (serverside) validation.
|
Returns |
string Error message if there is an error |
See Also |
validateLength(), validateRegEx(), doValidation() |
|
react |
public boolean react( mixed $events, [ boolean $status ] )
|
|
Defines the events that will be validated.
You can tell every (default) validator which "events"will be validated. This gives you detailed controlon a default validator in you dependencie validators."Event" stands for some properties of an element (length, valid, intro)as well as the used JavaScript event handler (js_onsubmit,js_onchange) for the element.Using react() you can for example switch off the validationof the RegExp (valid_e, valid_regexp) writing:$formelement->react("valid", false);
|
Parameter |
|
mixed |
$events |
|
|
Eighter a string with the name
of one "event" or an array of "events".
Known "events" are: all, length, valid, intro,
js_onsubmit, js_onchange. "length" controls
length_e, minlength and maxlength, "valid" controls
valid_e and valid_regexp and "intro" controls "intro", "intro_e".
"js_onsubmit" and "js_onchange" referr to the JavaScript
event handler. |
|
|
boolean |
$status |
= >>true<< |
|
Optional, if set to true the specified "events" will be validated,
otherwise validation is turned off (default: true = on) |
|
Returns |
boolean $ok Returns false if no valid events where found. |
Throws |
form_error |
See Also |
$val_events |
|
setValue |
public void setValue( mixed $value )
|
|
Sets the value of the form element.
|
Parameter |
|
|
Returns |
void |
|
getJS |
public array getJS( [ boolean $complex ] )
|
|
Returns JavaScript validation code.
See form_js_simple.js and form_js_complex.js for details on the JavaScriptvalidation code. This function build a record to "feed" the JavaScript formobject.
|
Parameter |
|
boolean |
$complex |
= >>false<< |
|
JS for form_js_complex.js? |
|
Returns |
array |
|
getName |
public string getName( )
|
|
Returns the HTML/JavaScript name of the element.
|
Returns |
string $name |
|
isHidden |
public bool isHidden( )
|
|
Is this a hidden element?
|
Returns |
bool |
|