|
Class TCheckBox
TCheckBox class
TCheckBox displays a check box on the page. You can specify the caption to
display beside the check box by setting the setText Text property. The
caption can appear either on the right or left of the check box, which is
determined by the setTextAlign TextAlign property.
To determine whether the TCheckBox component is checked, test the getChecked Checked property. The onCheckedChanged OnCheckedChanged
event is raised when the getChecked Checked state of the TCheckBox
component changes between posts to the server. You can provide an event handler
for the onCheckedChanged OnCheckedChanged event to to programmatically
control the actions performed when the state of the TCheckBox component changes
between posts to the server.
If setAutoPostBack AutoPostBack is set true, changing the check box
state will cause postback action. And if setCausesValidation
CausesValidation is true, validation will also be processed, which can be
further restricted within a setValidationGroup ValidationGroup.
Note, setText Text is rendered as is. Make sure it does not contain
unwanted characters that may bring security vulnerabilities.
-
TComponent
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TWebControl
implements
IStyleable
-
TCheckBox
implements
IPostBackDataHandler,
IValidatable,
IDataRenderer,
ISurroundable
Methods summary
protected
string
|
#
getTagName( )
Returns
string tag name of the button
Overrides
|
public
boolean
|
#
loadPostData( string $key, array $values )
Loads user input data. This method is primarly used by framework
developers.
Loads user input data. This method is primarly used by framework
developers.
Parameters
- $key
string the key that can be used to retrieve data from the input data collection
- $values
array the input data collection
Returns
boolean whether the data of the control has been changed
Implementation of
|
public
|
#
raisePostDataChangedEvent( )
Raises postdata changed event. This method raises onCheckedChanged
OnCheckedChanged event. This method is primarly used by framework
developers.
Raises postdata changed event. This method raises onCheckedChanged
OnCheckedChanged event. This method is primarly used by framework
developers.
Implementation of
|
public
|
#
onCheckedChanged( TEventParameter $param )
Raises OnCheckedChanged event when getChecked Checked changes
value during postback. If you override this method, be sure to call the parent
implementation so that the event delegates can be invoked.
Raises OnCheckedChanged event when getChecked Checked changes
value during postback. If you override this method, be sure to call the parent
implementation so that the event delegates can be invoked.
Parameters
|
public
|
#
onPreRender( mixed $param )
Registers the checkbox to receive postback data during postback. This is
necessary because a checkbox if unchecked, when postback, does not have direct
mapping between post data and the checkbox name.
Registers the checkbox to receive postback data during postback. This is
necessary because a checkbox if unchecked, when postback, does not have direct
mapping between post data and the checkbox name.
This method overrides the parent implementation and is invoked before
render.
Parameters
- $param
mixed event parameter
Overrides
|
public
boolean
|
#
getDataChanged( )
Returns a value indicating whether postback has caused the control data
change. This method is required by the IPostBackDataHandler interface.
Returns a value indicating whether postback has caused the control data
change. This method is required by the IPostBackDataHandler interface.
Returns
boolean whether postback has caused the control data change. False if the page is not in
postback mode.
Implementation of
|
public
mixed
|
#
getValidationPropertyValue( )
Returns the value of the property that needs validation.
Returns the value of the property that needs validation.
Returns
mixed the property value to be validated
Implementation of
|
public
boolean
|
#
getIsValid( )
Returns true if this control validated successfully. Defaults to true.
Returns true if this control validated successfully. Defaults to true.
Returns
boolean wether this control validated successfully.
Implementation of
|
public
boolean
|
#
setIsValid( boolean $value )
Parameters
- $value
boolean wether this control is valid.
Returns
boolean wether this control's validators validated successfully
Implementation of
|
public
string
|
#
getText( )
Returns
string the text caption of the checkbox
|
public
|
#
setText( string $value )
Sets the text caption of the checkbox.
Sets the text caption of the checkbox.
Parameters
- $value
string the text caption to be set
|
public
string
|
#
getValue( )
Returns
string the value of the checkbox. Defaults to empty.
|
public
|
#
setValue( string $value )
Parameters
- $value
string the value of the checkbox
|
public
TTextAlign
|
#
getTextAlign( )
Returns
TTextAlign
the alignment (Left or Right) of the text caption, defaults to
TTextAlign::Right.
|
public
|
#
setTextAlign( TTextAlign $value )
Parameters
- $value
TTextAlign
the alignment of the text caption. Valid values include Left and Right.
|
public
boolean
|
#
getChecked( )
Returns
boolean whether the checkbox is checked
|
public
|
#
setChecked( boolean $value )
Sets a value indicating whether the checkbox is to be checked or not.
Sets a value indicating whether the checkbox is to be checked or not.
Parameters
- $value
boolean whether the checkbox is to be checked or not.
|
public
boolean
|
#
getData( )
Returns the value indicating whether the checkbox is checked. This method is
required by IDataRenderer . It is the same as TCheckBox::getChecked() .
Returns
boolean whether the checkbox is checked.
Since
3.1.0
See
Implementation of
|
public
|
#
setData( boolean $value )
Sets the value indicating whether the checkbox is to be checked or not. This
method is required by IDataRenderer . It is the same as TCheckBox::setChecked() .
Parameters
- $value
boolean whether the checkbox is to be checked
Since
3.1.0
See
Implementation of
|
public
boolean
|
#
getAutoPostBack( )
Returns
boolean whether clicking on the checkbox will post the page.
|
public
|
#
setAutoPostBack( boolean $value )
Sets a value indicating whether clicking on the checkbox will post the
page.
Sets a value indicating whether clicking on the checkbox will post the
page.
Parameters
- $value
boolean whether clicking on the checkbox will post the page.
|
public
boolean
|
#
getCausesValidation( )
Returns
boolean whether postback event triggered by this checkbox will cause input validation,
default is true.
|
public
|
#
setCausesValidation( boolean $value )
Sets the value indicating whether postback event trigger by this checkbox
will cause input validation.
Sets the value indicating whether postback event trigger by this checkbox
will cause input validation.
Parameters
- $value
boolean whether postback event trigger by this checkbox will cause input validation.
|
public
string
|
#
getValidationGroup( )
Returns
string the group of validators which the checkbox causes validation upon postback
|
public
|
#
setValidationGroup( string $value )
Parameters
- $value
string the group of validators which the checkbox causes validation upon postback
|
public
string
|
#
getSurroundingTagID( )
Returns
string the id of the surrounding tag or this clientID if no such tag needed
Implementation of
|
public
|
#
render( THtmlWriter $writer )
Renders the checkbox control. This method overrides the parent implementation
by rendering a checkbox input element and a span element if needed.
Renders the checkbox control. This method overrides the parent implementation
by rendering a checkbox input element and a span element if needed.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
Overrides
|
public
TMap
|
#
getLabelAttributes( )
Returns
TMap
list of attributes to be rendered for label beside the checkbox
|
public
TMap
|
#
getInputAttributes( )
Returns
TMap
list of attributes to be rendered for the checkbox
|
protected
string
|
#
getValueAttribute( )
Returns
string the value attribute to be rendered
|
public
boolean
|
#
getEnableClientScript( )
Returns
boolean whether to render javascript.
|
public
|
#
setEnableClientScript( boolean $value )
Parameters
- $value
boolean whether to render javascript.
|
protected
boolean
|
#
getSpanNeeded( )
Check if we need a span tag to surround this control. The span tag will be
created if the Text property is set for this control.
Check if we need a span tag to surround this control. The span tag will be
created if the Text property is set for this control.
Returns
boolean wether this control needs a surrounding span tag
|
protected
|
#
renderLabel( THtmlWriter $writer, string $clientID, string $text )
Renders a label beside the checkbox.
Renders a label beside the checkbox.
Parameters
- $writer
THtmlWriter
the writer for the rendering purpose
- $clientID
string checkbox id
- $text
string label text
|
protected
|
#
renderInputTag( THtmlWriter $writer, string $clientID, string $onclick )
Renders a checkbox input element.
Renders a checkbox input element.
Parameters
- $writer
THtmlWriter
the writer for the rendering purpose
- $clientID
string checkbox id
- $onclick
string onclick js
|
protected
|
#
renderClientControlScript( mixed $writer )
Renders the client-script code.
Renders the client-script code.
|
protected
string
|
#
getClientClassName( )
Gets the name of the javascript class responsible for performing postback for
this control. This method overrides the parent implementation.
Gets the name of the javascript class responsible for performing postback for
this control. This method overrides the parent implementation.
Returns
string the javascript class name
|
protected
array
|
#
getPostBackOptions( )
Gets the post back options for this checkbox.
Gets the post back options for this checkbox.
Returns
array
|
Methods inherited from TWebControl
addAttributesToRender(),
clearStyle(),
copyBaseAttributes(),
createStyle(),
getAccessKey(),
getBackColor(),
getBorderColor(),
getBorderStyle(),
getBorderWidth(),
getCssClass(),
getDecorator(),
getDisplay(),
getEnsureId(),
getFont(),
getForeColor(),
getHasStyle(),
getHeight(),
getStyle(),
getTabIndex(),
getToolTip(),
getWidth(),
renderBeginTag(),
renderContents(),
renderEndTag(),
setAccessKey(),
setBackColor(),
setBorderColor(),
setBorderStyle(),
setBorderWidth(),
setCssClass(),
setDisplay(),
setEnsureId(),
setForeColor(),
setHeight(),
setStyle(),
setTabIndex(),
setToolTip(),
setWidth()
|
Methods inherited from TControl
__construct(),
__get(),
addParsedObject(),
addToPostDataLoader(),
addedControl(),
applyStyleSheetSkin(),
autoBindProperty(),
autoDataBindProperties(),
bindProperty(),
broadcastEvent(),
bubbleEvent(),
clearChildState(),
clearControlState(),
clearNamingContainer(),
clearViewState(),
convertUniqueIdToClientId(),
createChildControls(),
createControlCollection(),
dataBind(),
dataBindChildren(),
dataBindProperties(),
ensureChildControls(),
findControl(),
findControlsByID(),
findControlsByType(),
focus(),
getAdapter(),
getAllowChildControls(),
getAttribute(),
getAttributes(),
getChildControlsCreated(),
getClientID(),
getControlStage(),
getControlState(),
getControls(),
getCustomData(),
getEnableTheming(),
getEnableViewState(),
getEnabled(),
getHasAdapter(),
getHasAttributes(),
getHasChildInitialized(),
getHasControls(),
getHasInitialized(),
getHasLoaded(),
getHasLoadedPostData(),
getHasPreRendered(),
getID(),
getIsSkinApplied(),
getNamingContainer(),
getPage(),
getParent(),
getRegisteredObject(),
getSkinID(),
getSourceTemplateControl(),
getTemplateControl(),
getUniqueID(),
getViewState(),
getVisible(),
hasAttribute(),
initRecursive(),
isDescendentOf(),
isObjectRegistered(),
loadRecursive(),
loadState(),
loadStateRecursive(),
onDataBinding(),
onInit(),
onLoad(),
onUnload(),
preRenderRecursive(),
raiseBubbleEvent(),
registerObject(),
removeAttribute(),
removedControl(),
renderChildren(),
renderControl(),
saveState(),
saveStateRecursive(),
setAdapter(),
setAttribute(),
setChildControlsCreated(),
setControlStage(),
setControlState(),
setCustomData(),
setEnableTheming(),
setEnableViewState(),
setEnabled(),
setID(),
setPage(),
setSkinID(),
setTemplateControl(),
setViewState(),
setVisible(),
trackViewState(),
traverseChildControls(),
unbindProperty(),
unloadRecursive(),
unregisterObject()
|
Methods inherited from TComponent
__call(),
__destruct(),
__isset(),
__set(),
__sleep(),
__unset(),
__wakeup(),
asa(),
attachBehavior(),
attachBehaviors(),
attachClassBehavior(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
clearBehaviors(),
createdOnTemplate(),
detachBehavior(),
detachBehaviors(),
detachClassBehavior(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
evaluateStatements(),
fxAttachClassBehavior(),
fxDetachClassBehavior(),
getAutoGlobalListen(),
getBehaviorsEnabled(),
getClassHierarchy(),
getEventHandlers(),
getListeningToGlobalEvents(),
getSubProperty(),
hasEvent(),
hasEventHandler(),
hasProperty(),
isa(),
listen(),
raiseEvent(),
setSubProperty(),
unlisten()
|
Constants inherited from TControl
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID
|
|