Agile Toolkit  4.2
Agile Toolkit is a powerful web development framework. Inspired by GUI Applications development
Form_Field Class Reference
Inheritance diagram for Form_Field:
AbstractView AbstractObject Form_Field_Checkbox Form_Field_Date Form_Field_DateSelector Form_Field_Grouped Form_Field_Hidden Form_Field_Line Form_Field_Password Form_Field_Readonly Form_Field_Search Form_Field_SimpleCheckbox Form_Field_Slider Form_Field_Text Form_Field_Time Form_Field_Upload Form_Field_ValueList

Public Member Functions

 init ()
 setForm ($form)
 _cutField ()
 setMandatory ($mandatory=true)
 setReadonly ($readonly=true)
 isMandatory ()
 setCaption ($_caption)
 displayFieldError ($msg=null)
 setNoSave ()
 disable ()
 isDisabled ()
 set ($value)
 addButton ($label, $position='after')
 beforeField ()
 afterField ()
 aboveField ()
 belowField ()
 setComment ($text='')
 addComment ($text='')
 get ()
 setProperty ($property, $value)
 setAttr ($property, $value='true')
 setFieldHint ($var_args=null)
 setFieldTitle ($text)
 clearFieldValue ()
 loadPOST ()
 normalize ()
 validate ()
 validateField ($condition, $msg=null)
 _validateNotNull ($field)
 validateNotNULL ($msg=null)
 setNotNull ($msg='')
 setDefault ($default=null)
 getDefault ()
 getInput ($attr=array())
 setSeparator ($separator)
 render ()
 getTag ($tag, $attr=null, $value=null)
 setSource ()
 addField ()

Data Fields

 $error_template
 $error_mandatory
 $caption
 $short_name = null
 $attr = array()
 $no_save = null
 $field_prepend = ''
 $field_append = ''
 $comment = ' '
 $default_value = null
 $show_input_only
 $form = null
 $button_prepend = null
 $button_append = null

Protected Attributes

 $value = null
 $disabled = false
 $mandatory = false

Detailed Description

Implementation of abstract form's field

Author:
Romans <romans@adevel.com>
Version:
$Id$

Member Function Documentation

_cutField ( )
_validateNotNull ( field)
addButton ( label,
position = 'after' 
)

Position can be either 'before' or 'after'

addComment ( text = '')
addField ( )
disable ( )

Reimplemented in Form_Field_DateSelector.

displayFieldError ( msg = null)
getTag ( tag,
attr = null,
value = null 
)

Draw HTML attribute with supplied attributes.

Short description how this getTag may be used:

Use get tag to build HTML tag. echo getTag('img',array('src'=>'foo.gif','border'=>0);

The unobvius advantage of this function is ability to merge attribute arrays. For example, if you have function, which must display img tag, you may add optional $attr argument to this function.

function drawImage($src,$attr=array()){ echo getTag('img',array_merge(array('src'=>$src),$attr)); }

so calling drawImage('foo.gif') will echo:

The benefit from such a function shows up when you use 2nd argument:

1. adding additional attributes drawImage('foo.gif',array('border'=>0')); -->

(NOTE: you can even have attr templates!)

2. adding no-value attributes, such as nowrap: getTag('td',arary('nowrap'=>true)); -->

3. disabling some attributes. drawImage('foo.gif',array('src'=>false)); -->

4. re-defining attributes drawImage('foo.gif',array('src'=>'123')); -->

5. or you even can re-define tag itself drawImage('foo.gif',array( ''=>'input', 'type'=>'picture')); --> <input type="picture" src="foo.gif">

6. xml-valid tags without closing tag getTag('img/',array('src'=>'foo.gif')); --> <img src=>"foo.gif"/>

7. closing tags getTag('/td'); -->

8. using $value will add $value after tag followed by closing tag getTag('a',array('href'=>'foo.html'),'click here'); --> click here

9. you may not skip attribute argument. getTag('b','text in bold'); --> text in bold

10. nesting getTag('a',array('href'=>'foo.html'),getTag('b','click here')); --> click here

init ( )

Initialize object. Always call parent

This method is called for initialization

Reimplemented from AbstractObject.

Reimplemented in Form_Field_Text, Form_Field_Readonly, Form_Field_Checkbox, Form_Field_Upload, Form_Field_DateSelector, and Form_Field_DatePicker.

normalize ( )

Reimplemented in Form_Field_Number, and Form_Field_Password.

render ( )

Default render. Generates HTML presentation of the view based on $this->template and passes it to output() function which then inserts output into parent's template

For visual objects, their default action while rendering is rely on SMlite engine. For sake of simplicity and speed you can redefine this method with a simple call

Reimplemented from AbstractView.

Reimplemented in Form_Field_Hidden.

set ( value)
setAttr ( property,
value = 'true' 
)
setCaption ( _caption)
setComment ( text = '')
setDefault ( default = null)
setFieldHint ( var_args = null)

Reimplemented in Form_Field_Text.

setFieldTitle ( text)
setForm ( form)
setMandatory ( mandatory = true)
setNoSave ( )
setNotNull ( msg = '')

obsolete version of validateNotNULL

setProperty ( property,
value 
)
setReadonly ( readonly = true)
setSeparator ( separator)
setSource ( )
validateField ( condition,
msg = null 
)

Executes a callback. If callabck returns string, shows it as error message. If callback returns "false" shows either $msg or a standard error message about field being incorrect

validateNotNULL ( msg = null)

Adds asterisk to the field and validation


Field Documentation

$attr = array()
$button_append = null
$button_prepend = null
$caption
$comment = '&nbsp;'
$default_value = null
$disabled = false [protected]
$error_mandatory
$error_template

Description of the field shown next to it on the form

$field_append = ''
$field_prepend = ''
$form = null
$mandatory = false [protected]
$no_save = null
$short_name = null

Name of the object in owner's element array

Reimplemented from AbstractObject.

$show_input_only
$value = null [protected]

The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations