
Public Member Functions | |
| getContainer () | |
| Provides the container this field is in. | |
| setContainer (spunQ_IFieldContainer $container) | |
| Sets the container this field is in. | |
| getName () | |
| Provides the name of this field. | |
| getTypePath () | |
| A unique string identifying this field within the form. | |
| getTypePathPart () | |
| The last part of the type path of this field. | |
| addConverter (spunQ_IFieldValueConverter $converter) | |
| Adds another converter to this field. | |
| addValidator (spunQ_IFieldValidator $validator) | |
| Adds a field validator to this field. | |
| getConverters () | |
| Returns all converters registered via addConverter(). | |
| getValidators () | |
| Returns all validators registered via addValidator(). | |
| getHtmlId ($postfix= '') | |
| A unique string that is valid for the html id attribute. | |
| getHtmlName () | |
| Provides the value of the html name attribute this field needs. | |
| getUseSubmittedValue () | |
| Whether the user-submitted value should replace the default value. | |
| show ($value=NULL, $template=NULL, $templateParameters=array(), $htmlIdPostfix= '') | |
| Will generate and display html for this form field. | |
| showValidatorsJs () | |
| Prints javascript for validating this field. | |
| submittedValueValid () | |
| Returns whether the value submitted by the browser is valid This will only check whether the values received are acceptable to this field type. | |
| getSubmittedRawValue () | |
| Provides the raw value that was submitted with the request. | |
| getSubmittedValue () | |
| Provides the value that was submitted with the request. | |
| getValue () | |
| Alias for getSubmittedValue(). | |
| getDisplayValue ($originalValue) | |
| Returns the value to use for show(). | |
| getValidationMessages () | |
| Provides validation messages of this field. | |
| getFieldByPath ($path) | |
| Returns a field by its field path. | |
| _processSubmission (&$value) | |
| Initializes this field's submitted values. | |
Responsible for providing enough info to be rendered by a template and providing the values entered by the user. Is expected to use spunQ_IFieldValueConverters for converting fields between values suitable for templates and actual values to be further processed by the application.
Definition at line 10 of file IField.interface.php.
| spunQ_IField::_processSubmission | ( | &$ | value | ) |
Initializes this field's submitted values.
Intended to be called by this field's container.
| $value | The raw value that was submitted for this field. The field is expected to return the processed value via this in/out parameter. |
Implemented in spunQ_MultipleChoiceField, spunQ_SingleChoiceField, and spunQ_FieldIterator.
| spunQ_IField::addConverter | ( | spunQ_IFieldValueConverter $ | converter | ) |
Adds another converter to this field.
All converters will be used in the order in which they have been registered when converting from spunQ to raw values and in reverse order when converting back.
| A | new converter that will be used to convert application values to raw values (values as provided by php) and vice versa. |
$this | spunQ_IField::addValidator | ( | spunQ_IFieldValidator $ | validator | ) |
Adds a field validator to this field.
The field validator will be used to verify the validity of a submitted value by performing additional checks, such as range checks.
| $validator | The validator to use for submitted values. |
$this | spunQ_IField::getContainer | ( | ) |
| spunQ_IField::getConverters | ( | ) |
| spunQ_IField::getDisplayValue | ( | $ | originalValue | ) |
Returns the value to use for show().
This is either the value given as parameter or the submitted value, depending on form submission and the value of getUseSubmittedValue().
| $originalValue | The original value to be displayed if the form was not submitted. |
Implemented in spunQ_FieldGroup, and spunQ_FieldIterator.
| spunQ_IField::getFieldByPath | ( | $ | path | ) |
Returns a field by its field path.
| $path | Either a string or an array. The string should contain only the difference between this fields path and the searched field's path. |
| spunQ_HtmlException | If the field is not found. |
Implemented in spunQ_FieldGroup, and spunQ_FieldIterator.
| spunQ_IField::getHtmlId | ( | $ | postfix = '' |
) |
A unique string that is valid for the html id attribute.
Note that the generated id is only guaranteed to be unique within the form. If the same form needs to be shown more then once, the $postfix parameter needs to be provided.
| $postfix | An additional string that may be used to generate the unique string. A new value must be provided each time this field needs to be shown in a new form. |
| spunQ_IField::getHtmlName | ( | ) |
Provides the value of the html name attribute this field needs.
Implemented in spunQ_MultipleChoiceField.
| spunQ_IField::getName | ( | ) |
Provides the name of this field.
Does not serve any real purpose except helping developers retain their sanity when working with forms.
| spunQ_IField::getSubmittedRawValue | ( | ) |
Provides the raw value that was submitted with the request.
| spunQ_HtmlException | If the form was not submitted. |
| spunQ_IField::getSubmittedValue | ( | ) |
Provides the value that was submitted with the request.
The value provided here has been processed by all converters registered with addConverter() and verified by all validators registered via addValidator().
| spunQ_HtmlException | If the form was not submitted. |
| spunQ_IField::getTypePath | ( | ) |
A unique string identifying this field within the form.
The string is hierarchical, where fields containing other fields are present in the sub-fields, separated by periods (i.e. formTypeString.container.fieldTypePathPart).
| spunQ_IField::getTypePathPart | ( | ) |
| spunQ_IField::getUseSubmittedValue | ( | ) |
Whether the user-submitted value should replace the default value.
If this returns true, the show function will ignore its $value parameter and use getSubmittedValue() if it was valid. This function will only take effect when the user has submitted the form.
| spunQ_IField::getValidationMessages | ( | ) |
Provides validation messages of this field.
Messages are either created by converters or validators.
| spunQ_IField::getValidators | ( | ) |
| spunQ_IField::getValue | ( | ) |
| spunQ_IField::setContainer | ( | spunQ_IFieldContainer $ | container | ) |
| spunQ_IField::show | ( | $ | value = NULL, |
|
| $ | template = NULL, |
|||
| $ | templateParameters = array(), |
|||
| $ | htmlIdPostfix = '' | |||
| ) |
Will generate and display html for this form field.
| $value | The default value this field shall display. This is expected to be the actual value required in the application. It will be run through all converters before it is passed to the template. This value might be replaced by the value the user submitted if getUseSubmittedValue() yields true. | |
| $template | The template to use for converting this field into html. The template will receive the following parameters:
| |
| $templateParameters | Additional parameters to be passed to the template. | |
| $htmlIdPostfix | A postfix to be added to id attributes of the html form elements that are generated. A unique parameter must be provided each time the form is displayed. |
$this Implemented in spunQ_FieldGroup, and spunQ_FieldIterator.
| spunQ_IField::showValidatorsJs | ( | ) |
Prints javascript for validating this field.
$this Implemented in spunQ_FieldGroup, and spunQ_FieldIterator.
| spunQ_IField::submittedValueValid | ( | ) |
Returns whether the value submitted by the browser is valid This will only check whether the values received are acceptable to this field type.
It will not check the results of validators.
| spunQ_HtmlException | If the form was not submitted. |
Implemented in spunQ_FieldGroup, and spunQ_FieldIterator.
1.5.9