BlueShoes Application Framework made with PHP http://www.blueshoes.org/


Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: C:/usr/local/lib/php/blueshoes-4.2/core/html/form/Bs_FormFieldRadio.class.php
BlueShoes Application Framework - Form

Bs_FormFieldRadio

Bs_Object
   |
  +-- Bs_FormElement
     |
    +-- Bs_FormField
       |
      +-- Bs_FormFieldRadio

RADIO Form Field Class

 

public class Bs_FormFieldRadio extends Bs_FormField

RADIO Form Field Class
example tag('s):<input type='radio' name='gender' value='male'> male<input type='radio' name='gender' value='female'> femalewhat's special about this tag?there can (should) be more than one element with exactly the same name. this is how they getgrouped together. only one of the radio buttons can be selected at a time.- all the following object vars are of no use and thus ignored (mainly because the usercannot change the values at all, he can only select them):- bsDataType - mustContain- bsDataInfo - notContain- minLength - mustBeUnique- [maxLength] - regularExpression- mustStartWith - trim- notStartWith - remove- mustEndWith - replace- notEndWith - caseo) the support of radio buttons is limited yet, i think.this is not a killer feature, only nice to have.radio's can *always* be replaced with a select field, wile notvice versa. so it's ok for the moment.no dependencies here.

Authorsandrej arn <andrej@arn.li>
Version4.0.$id$
Copyrightblueshoes.org

 
Direct known subclasses: Bs_FormFieldSex

Methods inherited from Bs_FormField

bs_formfield, &getelement, getfield, addenforcecheckbox, isexplodable, getadvancedstyle, getadvancedstylehelper, setexplode, getlabel, validatemust, validateonlyoneof, validateonlyif, validateminlength, validatemaxlength, validatemuststartwith, validatenotstartwith, validatemustendwith, validatenotendwith, validatemustcontain, validatenotcontain, validateequalto, validatenotequalto, validatedatatype, validateregularexpression, validateadditionalcheck, validatemustbeunique, getvisibility, getonenterbehavior, getonentercode, applyonenterbehavior, shouldpersist, getdbdatatype, getdbfieldname, _getmaxlength, _gettagstringevents, getvalue, _gettagstringvalue, _gettagstringstyles, _gettagstringadditionaltags, getcaption, getcaptionforformoutput, geterror, gethelp, _highlightaccesskey, _getaccesskey, getfieldashidden, _getfieldnameforhtml, hasjavascript, ismust, _anyifcase, _markasused, _getbsdatainfonumber, isfilledin, _evalwrap, unpersisttrigger, geterrormessage, &serialize, unserialize, &encrypt, &decrypt, initfrompost

Methods inherited from Bs_FormElement

bs_formelement, hasformobject, setformobject, getcaption, getelement, getlevel, _doelementstringformat, _getparamvalue, getlanguagedependentvalue

Methods inherited from Bs_Object

isex, isexception, tostring, tohtml, persist, unpersist, bs_object, bbsetoutput, bbawake, bbisawake, bbxmsg, bbxfunctionstart, bbxfunctionend, bbxecho, bbxvar, bbxvardump, bbforcetrace, bbbufferstart, bbbufferget, bbbufferendflush, bbbufferendclean

Public Method Summary

void

Bs_FormFieldRadio()

Constructor.
string

&getField([ mixed $explodeKey, string $addEnforceCheckbox, string $elementList ])

Return some html code to display the field on a website in a form.
string

getRadios(string $fieldName, [ string $elementList ])

returns html code for the radio option buttons.
string

getOptionStringForValue(mixed $value, [ string $lang ])

returns the displayed value for an internal value.
void

inputManipulate()

overwrite parent method cause we don't want to manipulate anything here.Warning: documentation is missing.
mixed

inputValidate([ mixed $paramValue ])

validate the user inputs according to the object vars.Warning: documentation is missing.

Private Method Summary

array

_prepareOptionsData()

prepares the options to select from for this field.
void

_prepareOptions()

sets $this->_options based on the vars $optionsHard and $optionsEval.
void

_getOptionsString()

Warning: documentation is missing.

Fields inherited from Bs_FormField

$_bs_string, $_bs_array, $_bs_htmlutil, $_bs_date, $fieldtype, $caption, $defaulterrormessage, $errormessage, $errortype, $level, $editability, $accessrights, $visibility, $isused, $valuedefault, $valuedefaulttype, $valuereceived, $valuedisplay, $valueinternal, $savetodb, $dbfieldname, $dbdatatype, $dbnotnull, $dbprimarykey, $dbkey, $dbindexfulltext, $dbautoincrement, $dbunique, $dbforeignkey, $dbattributes, $explodeeval, $_explodearray, $direction, $styles, $advancedstyles, $events, $onenter, $additionaltags, $bsdatatype, $bsdatainfo, $bsdatamanipulation, $bsdatamanipvar, $enforce, $_must, $must, $mustif, $mustoneof, $mustoneofif, $onlyoneof, $onlyif, $onlyoneofif, $minlength, $maxlength, $muststartwith, $notstartwith, $mustendwith, $notendwith, $mustcontain, $notcontain, $equalto, $notequalto, $mustbeunique, $regularexpression, $additionalcheck, $trim, $remove, $removei, $replace, $replacei, $case, $codepostreceive, $codepostload, $this, $charsrule

Fields inherited from Bs_FormElement

$persister, $persisterid, $_form, $name, $elementtype, $formid, $container, $orderid, $elementstringformat, $persistervarsettings, $this

Private Field Summary

string

$optionsType

how to fill in the options for this radio button.
array

$_options

made up in _prepareOptions() using $optionsHard and $optionsEval.
array

$optionsHard

the options that are selectable for the user.
mixed

$optionsEval

php code to be evaluated. has to return an array (hash or vector)
string

$align

how to align the options.

Private Constant Summary

BS_FORMFIELDRADIO_VERSION >>4.0.$x$<< Warning: documentation is missing.

Public Method Details

Bs_FormFieldRadio

public void Bs_FormFieldRadio( )

  Constructor.

Returns void


&getField

public string &getField( [ mixed $explodeKey, string $addEnforceCheckbox, string $elementList ] )

  Return some html code to display the field on a website in a form.
overwrites parent method.

Parameter
mixed $explodeKey = >>NULL,<<
(int or string, not used here (2do))
string $addEnforceCheckbox = >>TRUE,<<
default is TRUE. adds the enforce checkbox automatically, if needed. see (parent::)addEnforceCheckbox().
string $elementList = >>null<<
(see getRadios())
Returns string

some html code


getRadios

public string getRadios( string $fieldName, [ string $elementList ] )

  returns html code for the radio option buttons.
param elementList:if you want to fetch just some or just one option, you can give the keys of them here.default is NULL which makes the method return all options.

Parameter
string $fieldName
string $elementList = >>null<<
(see above)
Returns string

(html code)


getOptionStringForValue

public string getOptionStringForValue( mixed $value, [ string $lang ] )

  returns the displayed value for an internal value.
example:you have <option value="ca">Canada</option>getOptionStringForValue('ca') returns 'Canada'.big note: this method is (and should be) identical in Bs_FormFieldRadio and Bs_FormFieldSelect.

Parameter
mixed $value
(string or so)
string $lang = >>null<<
(...)
Returns string

(empty string if that value is not defined. so you won't know if it was 'not found' or empty.)


inputManipulate

public void inputManipulate( )

  overwrite parent method cause we don't want to manipulate anything here.

Warning: documentation is missing.

Returns void


inputValidate

public mixed inputValidate( [ mixed $paramValue ] )

  validate the user inputs according to the object vars.
overwrites parent method. read manual there. additional information:the order for data validation is: (-- means check omitted here)1) must 5) --mustStartWith 9) --mustContain 13) --mustBeUnique2) onlyOneOf 6) --notStartWith 10) --notContain 14) --regularExpression3) --minLength 7) --mustEndWith 11) --equalTo4) --maxLength 8) --notEndWith 12) --notEqualTo

Warning: documentation is missing.

Parameter
mixed $paramValue = >>NULL<<
(only used internally!!!)
Returns mixed


Private Method Details

_prepareOptionsData

private array _prepareOptionsData( )

  prepares the options to select from for this field.
big note: this method is (and should be) identical in Bs_FormFieldRadio and Bs_FormFieldSelect.

Returns array


_prepareOptions

private void _prepareOptions( )

  sets $this->_options based on the vars $optionsHard and $optionsEval.

Returns void

See Also $optionsType, $optionsHard, $optionsEval, $_options

_getOptionsString

private void _getOptionsString( )

 

Warning: documentation is missing.

Returns void


Private Field Details

$optionsType

private string $optionsType

>><<

how to fill in the options for this radio button.
one of 'eval' or 'hard'.if not set, the one var that is used is used :) if both are used(speaking of $optionsHard and $optionsEval) then $optionsHard isthe default.

See Also _prepareOptions(), $optionsHard, $optionsEval, $_options

$_options

private array $_options

>><<

made up in _prepareOptions() using $optionsHard and $optionsEval.

See Also _prepareOptions(), $optionsType, $optionsHard, $optionsEval

$optionsHard

private array $optionsHard

>><<

the options that are selectable for the user.
the following data structures are allowed:array('1'=>'one', '2'=>'two', '3'=>'three');array('en'=>array('1'=>'one','2'=>'two','3'=>'three'), 'de'=>array('1'=>'eins','2'=>'zwei','3'=>'drei'), 'fr'=>array('1'=>'un','2'=>'deux','3'=>'trois'));while these are not:'one';array('one', 'two', 'three');array('en'=>'one', 'de'=>'eins', 'fr'=>'un');array('en'=>array('one','two','three'), 'de'=>array('eins','zwei','drei'), 'fr'=>array('un','deux','trois'));because it would not be possible to know the difference sometimes.you always need key=>val, even if the key and the value is the same.

See Also _prepareOptions(), $optionsType, $optionsEval, $_options

$optionsEval

private mixed $optionsEval

>><<

php code to be evaluated. has to return an array (hash or vector)
that will be used for the option tags of this select field.the code is executed in $this->_prepareOptions() so it's in thescope of a method of this object. this means you can use varsfrom here etc.usually a string, can be a hash because it's language dependant.

See Also _prepareOptions(), $optionsType, $optionsHard, $_options

$align

private string $align

>><<

how to align the options.
'v' = vertical: (default)value 1value 2value 3'h' = horizontal:value 1, value 2, value 3


Private Constant Details

BS_FORMFIELDRADIO_VERSION

define( BS_FORMFIELDRADIO_VERSION, >>4.0.$x$<< )
Case: default: case sensitive




Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta