PropertyEventMethodIndex
WebSquare.uiplugin.selectbox - 5.0_1.3015A.20180410.143527

Functions similar to the select tag of HTML. Allows the end user to select one or multiple items.
Note that the div tag is at the highest level when the SelectBox component is rendered on the broweser. In order to use the select tag, add additional settings.

Type

uiplugin

Property Summary

allOption
[default:false, true] Whether to allow all options or not. The label is "-All-" and the value is "all".
appearance
[default:minimal,full] Appearance property of xforms select1. In case of minimal, a select box will be displayed, and in case of full, radio buttons will be displayed.
chooseOption
[default:false,true] Displays the selection options. In case the chooseOptionLabel is not defined, the label will be "-Choose-" and the value ""(empty string).
chooseOptionLabel
Define the text (label) to guide selection when the chooseOption is true.
class
Same as the class property in HTML standard. One or more classes defined in the CSS file or in the style block can be applied (through the use of the space as the separator).
closeonmouseleave
[default:false, true] Closes the sub-layer upon the mouseleave event.
dataListAutoRefresh
[default: false, true] Automatically updates the DataList bound with the SelectBox upon execution of addItem or deleteItem.
delimiter
Separates the value from the label. Used by the displayMode property.
direction
[defulat:auto, down, up] Opening direction of the items
disabled
[default:false, true] Disables the component.
disabledClass
Name of the class to apply when the disabled property is true.
displaymessage
[default:false, true] Displays the result message upon a validation failure by the validation API.
displayMode
[default:label, value delim label, label delim value, value] Mode of displaying selection items. Both the label and the value can be displayed together. The delimiter property will be used as the delim.
emptyItem
[default:false, true] When a value or index not in the item list is set (by a method such as setValue or setSelectedIndex), sets an empty label or value (empty string).
emptyValue
When the emptyItem property is true, sets the value with the specified value of the emptyValue property.
escape
Converts <>&" characters into HTML Escape characters.
id
ID of the component. Allocated as a global object. Scripts access the component through the ID.
invalidMessage
A message displayed upon failure of the validation API. The displaymessage property must be true.
invalidMessageFunc
Name of the function that dynamically displays messages upon a validation failure by the validation API.
labelWidthAuto
[default:false, true] Ignores the defined width of the component, and automatically adjusts the width to the longest text.
mandatory
[default:false, true] Whether to check the mandatory input or not when calling the validation API.
optionOrder
[default:choose, all] Order of displaying selection items. all is to display both All and selection items.
preventWheelEvent
[default:false, true] Prevents the mouseWheelEvent fin the SelectBox.
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
renderType
[default:component, auto, native, select] Layout of the component on the browser.
selectedData
[default: true, false] Keeps the user’s eelection that does not exist in the bound DataList.
setDataRemoveAll
Initializes the data upon removeAll.
sortMethod
[default:ascending, descending] Referenced by the sortOption property. The method to sort the values defined in the sortOption.
sortOption
[label,value] Used to sort the items by label or value.
submenuSize
[default:auto, fixed] Whether to fit the list size to the label or fix it to the default width. Not valid when the labelWidthAuto property is true.
tabIndex
Same as the tabindex property in HTML standard. Indicates the focusing order of the component by the tab key.
textAlign
[default:center, left, right] Text alignment
title
Same as the title property of HTML. Displays the Text upon the end user's hovering the mouse over the browser.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component.
tooltipClass
Class to apply to the tooltip when the tooltipDisplay is true.
tooltipDisplay
[default:false, true] Whether to display the tooltip or not.
tooltipDisplayItem
[default:false, true] Displays the tooltip upon the user’s hovering the mouse over the choice list.
tooltipTime
Time to display the tooltip (in seconds) when the tooltipDisplay is true.
useLocale
[default:false, true] True to use the multi-language key to display the labels on the WebSquare5 client.
userData1
User-defined property
userData2
User-defined property
userData3
User-defined property
visibleRowNum
Number of the rows to be displayed
wmode
[default:false, true] Use wmode. To be used when the component is hidden by an object (such as activeX or flash).

Event Summary

onblur
Triggered when the focus is lost.
onchange
riggered upon a selection change.
onclick
Triggered upon the end user's clicking the SelectBox component.
ondblclick
Triggered upon the end user's double-clicking the SelectBox component.
onfocus
Triggered upon the component being focused.
onviewchange
Triggered when a value on the list is changed through the keyboard or mouse. Does not occur upon a value change by a script. (Similar to the native onchange event.)

Method Summary

addClass( className )
Adds a class to the component.
addItem( value , label , index , refresh )
Adds an item. If no index is specified, the item will be appended to the lower node.
bind( eventType , function )
Dynamically allocates events to the component.
changeChooseOption( newValue , newLabel )
Changes the label and the value of the chooseOption.
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
deleteItem( idx , refresh )
Deletes the item of the corresponding index. If both the chooseOption and the allOption are true, the -Select- item will be considered being included in index numbering.
focus( )
Moves the focus to the component.
getDisabled( )
Gets the current value of the disabled property.
getGenerator( )
Called by a component under the Generator component. When called, gets the parent Generator object.
getID( )
Gets the ID of the component.
getItemCount( )
Returns the number of the items. If the chooseOption or allOption is true, -All- or -Select- will be considered as an item and will be also included in item counting.
getOpacity( )
Gets the opacity of the component defined in CSS.
getPluginName( )
Gets the pluginName (or the name) of the component.
getPosition( positionName )
Gets the left or top position of the component.
getReadOnly( )
Gets the current setting of the readOnly property.
getSelectedIndex( )
Returns the index of the selected item. If the chooseOption or allOption is true, -All- or -Select- will be considered as an item and will be also included in index numbering.
getSize( sizeName )
Gets the size of the component.
getStyle( propertyName )
Gets the current value of the propertyName of the component defined in CSS.
getStyleValue( style )
[deprecated] Use getStyle instead.
getText( isOriginal )
Returns the index of the currently selected item.
getTitle( )
Gets the title value.
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
getValue( )
Returns the value of the selected item.
hasClass( className )
Checks whether the component has className received as a parameter or not.
hide( )
Hides the component.
removeAll( isInitialize )
[default:false, true] Removes all items. If the chooseOption or allOption is true, the items for which isInitialize is true will not be deleted.
removeClass( className )
Removes className from the component.
setDisabled( disabled )
Sets the disabled property.
setEventPause( evList , flag )
Disables or enables the component event.
setNodeSet( nodeset , label , value )
Changes the itemset setting. When bound with a DataList, the nodeset must start with data: prefix.
setOpacity( value )
Sets the opacity of the component.
setPosition( left , top , mode )
Sets the position (left, top) of the component.
setReadOnly( readOnly )
Controls the "readOnly" property.
setRef( ref )
Dynamically sets the ref binding. Add data: prefix to bind with a DataCollection.
setSelectedIndex( idx )
Selects the item of the corresponding index. If the chooseOption or allOption is true, -All- or -Select- will be considered as an item and will be also included in index numbering.
setSize( width , heigth )
Sets the size (width, height) of the component.
setStyle( propertyName , value )
Sets the style of the specified property.
setText( lbl , isOriginal )
Selects an item of which label is same as the specified lbl value.
setTitle( title )
Sets the title of the component.
setUserData( key , value )
Sets the user data in the component.
setValue( value )
Selects an item which contains the value received as a parameter, and sets the value in the selected item.
show( displayType )
Displays the component.
showChooseOption( chooseOption )
Sets the chooseOption.
toggleClass( className )
Removes a class named className, or if there is no such a class, adds a class named className.
trigger( type , array )
Triggers a certain event registered for the component.
unbind( type , function )
Removes an event registered for the component.
unbindRef( )
Releases the ref binding.
validate( )
Validates the component according to the specified properties.
validateObject( )
Validates the component according to the specified properties.
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.

Property Detail

allOption
[default:false, true] Whether to allow all options or not. The label is "-All-" and the value is "all".
appearance
[default:minimal,full] Appearance property of xforms select1. In case of minimal, a select box will be displayed, and in case of full, radio buttons will be displayed.
chooseOption
[default:false,true] Displays the selection options. In case the chooseOptionLabel is not defined, the label will be "-Choose-" and the value ""(empty string).
chooseOptionLabel
Define the text (label) to guide selection when the chooseOption is true.
class
Same as the class property in HTML standard. One or more classes defined in the CSS file or in the style block can be applied (through the use of the space as the separator).
WebSquare5 Engine applies different classes to different components. By defining a common class, the common class can be applied to multiple components.
closeonmouseleave
[default:false, true] Closes the sub-layer upon the mouseleave event.
dataListAutoRefresh
[default: false, true] Automatically updates the DataList bound with the SelectBox upon execution of addItem or deleteItem.
true: Automatically updates. false: Default Not automatically update.
Required for lower compatibility. Setting true is recommended. (Set in config.xml to apply to all.)
delimiter
Separates the value from the label. Used by the displayMode property.
Used as the "delim" in the displayMode property.
direction
[defulat:auto, down, up] Opening direction of the items
disabled
[default:false, true] Disables the component.
disabledClass
Name of the class to apply when the disabled property is true.
displaymessage
[default:false, true] Displays the result message upon a validation failure by the validation API.
Displays the result message upon a validation failure by the validation API. Define a customized message using the invalidMessageFunc property.
displayMode
[default:label, value delim label, label delim value, value] Mode of displaying selection items. Both the label and the value can be displayed together. The delimiter property will be used as the delim.
label (Default): "label"
value delilm label: "value + delimiter + label"
label delim value: "label + delimiter + value"
value: "value"
emptyItem
[default:false, true] When a value or index not in the item list is set (by a method such as setValue or setSelectedIndex), sets an empty label or value (empty string).
Use the emptyValue property to set an additional value. If an item is added or removed while there is an empty value, the first item will be selected. (Same as selectedIndex=-1 of HTML select.)
Note that the label is still an empty string even when the chooseOption is true.
emptyValue
When the emptyItem property is true, sets the value with the specified value of the emptyValue property.
When the emptyItem property is true, sets the value with the specified value of the emptyValue property. Note that although the value is same as the emptyValue, the label will be empty.
escape
Converts <>&" into HTML escape character, and displays the converted character.
id
ID of the component. Allocated as a global object. Scripts access the component through the ID.
invalidMessage
A message displayed upon failure of the validation API. The displaymessage property must be true.
Cannot be used with invalidMessageFunc at the same time.
invalidMessageFunc
Name of the function that dynamically displays messages upon a validation failure by the validation API.
The displaymessage property must be true. Cannot be used with invalidMessage at the same time.
The customized function (in the following example) gets the type of the value through this.getType() and the value through this.getValue(), and returns the dynamically created message through the use of the type and the value.
(Type) mandatory, allowChar, ignoreChar, minLength, maxLength, minByteLength, maxByteLength
(Example) function fn_msg(){ var tmpType = this.getType(); var tmpValue = this.getValue(); if(tmpType == "mandatory"){ return "Required."; } }
labelWidthAuto
[default:false, true] Ignores the defined width of the component, and automatically adjusts the width to the longest text.
Note when the position is absolute in the style and the component is on the right side, the component position may get unstable. Put the component on the left side, or set the component position as relative.
mandatory
[default:false, true] Whether to check the mandatory input or not when calling the validation API.
optionOrder
[default:choose, all] Order of displaying selection items. all is to display both All and selection items.
preventWheelEvent
[default:false, true] Prevents the mouseWheelEvent fin the SelectBox.
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
(Format: data: [DataCollection ID].[Key id or Column id]) (Example) data:dataMap1.dept
When bound with a DataList, the row selected on the GridView will be bound.
Specify the XPath of the XML data to interface with the instance data. (Example) res/userInfo/dept/@value
renderType
[default:component, auto, native, select] Layout of the component on the browser.
component : Uses div tag as the highest tab. Use the select tag under the div tag.
native : Mostly used to comply with web accessibility requirements. Provides same UIs and features on all browsers with the same title for web accessibility.
select : Renders only the select tag. Complies with web accessibility requirements, but does not guarantee UI consistency on all browsers.
auto : Automatically selects the renderType. (native for mobile browsers, and component for others.)
selectedData
[default: true, false] Keeps the user’s eelection that does not exist in the bound DataList.
true (Default): Keeps the newly selected item and ignores the previously selected item.
false: Keeps the selection.
setDataRemoveAll
Initializes the data upon removeAll.
sortMethod
[default:ascending, descending] Referenced by the sortOption property. The method to sort the values defined in the sortOption.
sortOption
[label,value] Used to sort the items by label or value.
In the default, the items are sorted in ascending order. In case sortMethod is specified, the items will be sorted in the corresponding method.
submenuSize
[default:auto, fixed] Whether to fit the list size to the label or fix it to the default width. Not valid when the labelWidthAuto property is true.
tabIndex
Same as the tabindex property in HTML standard. Indicates the focusing order of the component by the tab key.
textAlign
[default:center, left, right] Text alignment.
title
Same as the title property of HTML. Displays the Text upon the end user's hovering the mouse over the browser. Generally used to support web accessibility.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component. Displayed upon mouse-over.다.
tooltipClass
Class to apply to the tooltip when the tooltipDisplay is true.
tooltipDisplay
[default:false, true] Whether to display the tooltip or not.
tooltipDisplayItem
[default:false, true] Displays the tooltip upon the user’s hovering the mouse over the choice list.
true: Displays the tooltip.
false (Default): Not display.
Version: Added in 5.0_1.2705B.20170721.164120.
tooltipTime
Time to display the tooltip (in seconds) when the tooltipDisplay is true.
useLocale
[default:false, true] True to use the multi-language key to display the labels on the WebSquare5 client.
Uses the multi-language key to display the label on the client side.
userData1
User-defined property. Use getUserData("userData1") to get the data.
userData2
User-defined property. Use getUserData("userData2") to get the data.
userData3
User-defined property. Use getUserData("userData3") to get the data.
visibleRowNum
Number of the rows to be displayed
wmode
[default:false, true] se wmode. To be used when the component is hidden by an object (such as activeX or flash).
sing the wmode (true) is to put the component above the object tag, not to set the wmode. It is recommended to use the wmode in the object tag (such as activeX or flash).

Event Detail

onblur
Triggered when the focus is lost.
Parameter
nametypedescription
eObjectEvent object
onchange
riggered upon a selection change.
onclick
Triggered upon the end user's clicking the SelectBox component.
Parameter
nametypedescription
eObjectEvent object
ondblclick
Triggered upon the end user's double-clicking the SelectBox component.
Parameter
nametypedescription
eObjectEvent object
onfocus
Triggered upon the component being focused.
Parameter
nametypedescription
eObjectEvent object
onviewchange
Triggered when a value on the list is changed through the keyboard or mouse. Does not occur upon a value change by a script. (Similar to the native onchange event.)
Parameter
nametypedescription
infoJSONReturns an object containing oldValue, newValue, oldSelectedIndex, and newSelectedIndex. <String> info.oldValue : Old value <String> info.newValue : New value <Number> info.oldSelectedIndex : Old index <Number> info.newSelectedIndex : New index
Sample
<script ev:event="onviewchange( info )"><![CDATA[ var oldValue = info.oldValue; var newValue = info.newValue; var oldSelectedIndex = info.oldSelectedIndex; var newSelectedIndex = info.newSelectedIndex; ]]></script>

Method Detail

addClass( className )
Adds a class to the component.
Parameter
nametyperequireddescription
classNameStringYName of the class to add
Sample
// Add oddClass to component input1. input1.addClass("oddClass");
addItem( value , label , index , refresh )
Adds an item. If no index is specified, the item will be appended to the lower node.
If the chooseOption or allOption is true, -All- or -Select- will be considered as an item and will be also included in index numbering.
Parameter
nametyperequireddescription
valueStringYValue of the item
labelStringYLabel of the item
indexNumberNIndex of the item
refreshBooleanNAutomatically updates the bound DataList (instance). If undefined, the value of the dataListAutoRefresh property will be used.
Return
typedescription
NumberIndex of the added item
Sample
// Do not append, and set the chooseOption as true. <xf:select1 chooseOption="true" id="selectbox1" style="position: relative;width: 148px;height: 21px;" disabledClass="w2selectbox_disabled" appearance="minimal"> <xf:choices></xf:choices> </xf:select1> // Add an item without specifying an index. selectbox1.addItem( 'M', 'Male' ); // dded as the last item under "-Select-". The sequence will be "-Select-" and "Male". // (Return) 1 // Add an item with specifying the index as "0". selectbox1.addItem( 'F', 'Female' ); // Added to index 0 position before "-Select-". The sequence will be "Female","-Select-", and "Male". // (Return Example) 0
bind( eventType , function )
Dynamically allocates events to the component.
Parameter
nametyperequireddescription
eventTypeStringYName of the event to allocate.
functionFunctionYHandler function of the event to allocate.
Sample
// Define the event handler function for the onclick event in the input component, and bind the function. input1.bind("onclick", function(e){ alert(input1.getValue();})); // Bind commObj.ev_click function for the onclick event with component input1. var commObj = {}; commObj.ev_click = function(e){ alert("click :: "+this.id); }; input1.bind("onclick", commObj.ev_click );
changeChooseOption( newValue , newLabel )
Changes the label and the value of the chooseOption.
Parameter
nametyperequireddescription
newValueStringYNew value
newLabelStringYNew label
Sample
Change to value "0" and label "Choose". selectbox1.changeChooseOption("0","Choose");
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
In the default setting, only the classes added by addClass will be applied. In order to directly remove the class defined in the "class" property of the component, add the following setting in config.xml file.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
oldClassNameStringYName of the class to remove
newClassNameStringYName of the class to add
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Change tmpInputClass class to tmpInputWarninClass. input1.changeClass("tmpInputClass","tmpInputWarninClass");
deleteItem( idx , refresh )
Deletes the item of the corresponding index. If both the chooseOption and the allOption are true, the -Select- item will be considered being included in index numbering.
Parameter
nametyperequireddescription
idxNumberYIndex of the item to delete
refreshBooleanNAutomatically updates the bound DataList (instance). If undefined, the value of the dataListAutoRefresh property will be used.
Return
typedescription
JSONJSON containing information of the deleted item
<String> label : Label of the item <String> value : Value of the item.
Sample
// When the chooseOption property and the items are defined as shown below. <xf:select1 id="selectbox1" chooseOption="true" style="position: relative;width: 148px;height: 21px;"disabledClass=" w2selectbox_disabled" appearance="minimal" > <xf:choices> <xf:item> <xf:label><![CDATA[남성]]></xf:label> <xf:value><![CDATA[M]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[여성]]></xf:label> <xf:value><![CDATA[F]]></xf:value> </xf:item> </xf:choices> </xf:select1> // Delete the item of index 1. var returnValue = selectbox1.deleteItem(1); // Index 0 will be -Select-. The Male item will be deleted. // (Return ) {label: "Male", value: "M"}
focus( )
Moves the focus to the component.
getDisabled( )
Gets the current value of the disabled property.
Return
typedescription
BooleanThe value of the disabled property.
Sample
var returnValue = componentId.getDisabled(); (Return example) false
getGenerator( )
Called by a component under the Generator component. When called, gets the parent Generator object.
Return
typedescription
ObjectParent Generator object
Sample
<w2:generator id="generator1"> <w2:trigger id="trigger1" ev:onclick="scwin.trigger1_onclick"></w2:trigger></w2:generator> scwin.trigger1.onclick = function(){ console.log(this.getGenerator());} // Click trigger1 to display the generator1 object on the console. // See https://inswave.com/jira/browse/WPF-1425.
getID( )
Gets the ID of the component.
Return
typedescription
StringID of the WebSquare5 component
Sample
// The WebSquare5 component dynamically received as a parameter can be used as shown in the following. function fn_validCheck(tmpObj){ // tmpObj has an ID of "input1". var compID = tmpObj.getID(); // (Return Example) "input1" }
getItemCount( )
Returns the number of the items. If the chooseOption or allOption is true, -All- or -Select- will be considered as an item and will be also included in item counting.
Return
typedescription
NumberNumber of the items
Sample
// Set the chooseOption as shown below. <xf:select1 id="selectbox1" chooseOption="true" style="position: relative;width: 148px;height: 21px;"disabledClass=" w2selectbox_disabled" appearance="minimal" > <xf:choices> <xf:item> <xf:label><![CDATA[남성]]></xf:label> <xf:value><![CDATA[M]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[여성]]></xf:label> <xf:value><![CDATA[F]]></xf:value> </xf:item> </xf:choices> </xf:select1> var returnValue = selectbox1.getItemCount(); // (Return) 3
getOpacity( )
Gets the opacity of the component defined in CSS.
Return
typedescription
IntegerOpacity
Sample
// Apply opacity CSS to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;opacity:0.2;"></xf:input> var returnValue = input1.getOpacity(); // "returnValue" is a real number between 0 and 1. // (Return Value) "0.2"
getPluginName( )
Gets the pluginName (or the name) of the component.
Return
typedescription
StringpluginName of the WebSquare5 component
Sample
// For a WebSquare5 object dynamically received by a common function, conditional statements can be used as shown below. var commObj = {}; commObj.fn_makeReqData = function(tmpObj){ var tmpID = tmpObj.getID(); // Component ID var tmpCompType = tmpObj.getPluginName(); // Component Type if(tmpCompType == "input"){ //..Logic.. }else if(tmpCompType == "gridView"){ //..Logic .. }else{ //..Logic.. } };
getPosition( positionName )
Gets the left or top position of the component. If set by %, the corresponding pixel value will be returned.
Parameter
nametyperequireddescription
positionNameStringY[left,top] Type of the position
Return
typedescription
NumberPosition of the component
Sample
// Apply margin CSS to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin:10px;"></xf:input> var returnValue = input1.getPosition("top"); // The returnValue will be a position in pixels. // (Return Example) 10
getReadOnly( )
Gets the current setting of the readOnly property.
Return
typedescription
BooleanThe current setting of the readOnly property
Sample
var returnValue = componentId.getReadOnly(); // (Return Example) false
getSelectedIndex( )
Returns the index of the selected item. If the chooseOption or allOption is true, -All- or -Select- will be considered as an item and will be also included in index numbering.
Return
typedescription
NumberIndex of the selected item
Sample
// The "chooseOption" is "true" and "Male" item is selected. <xf:select1 id="selectbox1" chooseOption="true" style="position: relative;width: 148px;height: 21px;"disabledClass=" w2selectbox_disabled" appearance="minimal" > <xf:choices> <xf:item> <xf:label><![CDATA[남성]]></xf:label> <xf:value><![CDATA[M]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[여성]]></xf:label> <xf:value><![CDATA[F]]></xf:value> </xf:item> </xf:choices> </xf:select1> var returnValue = selectbox1.getSelectedIndex(); // (Return Example) 1
getSize( sizeName )
Gets the size of the component. If set by "%", the corresponding pixel value will be returned.
Parameter
nametyperequireddescription
sizeNameStringY[height, innerHeight, outerHeight, outerMarginHeight, width, innerWidth, outerWidth, outerMarginWidth] Type of the size. For the calculation of each size type, see below.
height : element.clientHeight innerHeight : element.clientHeight + padding outerHeight : element.clientHeight + padding + border outerMarginHeight : element.clientHeight + padding + border + margin width : element.clientWidth innerWidth : element.clientWidth + padding outerWidth : element.clientWidth + padding + border outerMarginWidth : element.clientWidth + padding + border + margin
Return
typedescription
NumberSize of the component
Sample
var returnValue = componentId.getSize("width"); // "returnValue" will be a size in pixels. If set by "%", the corresponding pixel value will be returned. // (Return Example) 100
getStyle( propertyName )
Gets the current value of the propertyName of the component defined in CSS.
Parameter
nametyperequireddescription
propertyNameStringYName of the property in the style
Return
typedescription
StringStyle value
Sample
// Define an Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;"></xf:input> var returnValue = input1.getStyle("width"); // (Return Example) "144px"
getStyleValue( style )
[deprecated] Use getStyle instead.
Gets the current value of the propertyName of the component defined in CSS.
Parameter
nametyperequireddescription
styleStringYName of the property defined in the style
Return
typedescription
StringValue defined in the style property. (In case of a color, the hexcode of the color will be returned.)
getText( isOriginal )
Returns the index of the currently selected item.
Parameter
nametyperequireddescription
isOriginalBooleanN[default:true, false] In case of true, returns unformatted original Text. In case of false, the formatted value will be returned.
Return
typedescription
Stringlabel of the currently selected item
Sample
// An item of which label "Male" is selected. var returnValue = selectbox1.getText(); // (Return) "Male"
getTitle( )
Gets the title value.
Return
typedescription
StringTitle value
Sample
// Define the "title" for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" title="이름 입력"></xf:input> var tmpTitle = input1.getTitle(); // (Return Example ) "Input Name"
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
Parameter
nametyperequireddescription
keyStringYRandom data key
Return
typedescription
StringData of the corresponding key
Sample
// Apply the customized property (eduTest) to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" eduTest="Hello"></xf:input> input1.getUserData("eduTest"); // (Return Example) "Hello" // Use setUserData. input1.setUserData("eduTest","WebSquare"); input1.getUserData("WebSquare"); // (Return Example) "Hello"
getValue( )
Returns the value of the selected item.
Return
typedescription
StringValue of the selected item
Sample
// An item of which value "M" is selected. var returnValue = selectbox1.getValue(); // (Return) "M"
hasClass( className )
Checks whether the component has className received as a parameter or not.
Parameter
nametyperequireddescription
classNameStringYclassName to check
Return
typedescription
BooleanWhether the component has the class or not
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> var returnValue = input1.hasClass("tmpInputClass"); // (Return Example) true
hide( )
Hides the component.
removeAll( isInitialize )
[default:false, true] Removes all items. If the chooseOption or allOption is true, the items for which isInitialize is true will not be deleted.
Parameter
nametyperequireddescription
isInitializeBooleanN
Sample
// Remove all items including chooseOption and allOption items. selectbox1.removeAll(); // Remove all items but chooseOption and allOption items. selectbox1.removeAll(true);
removeClass( className )
Removes className from the component.
In the default setting, only the classes added by addClass will be applied. In order to directly remove the class defined in the "class" property of the component, add the following setting in config.xml file.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYName of the class to remove
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.removeClass("tmpInputClass");
setDisabled( disabled )
Sets the disabled property. True to disable, or false not to disable.
Parameter
nametyperequireddescription
disabledBooleanYTrue to disable, or false not to disable.
Sample
// Disable the component. componentId.setDisabled(true);
setEventPause( evList , flag )
Disables or enables the component event.
Parameter
nametyperequireddescription
evListStringNList of the events. If not specified, all user events of the component will be listed. (Enter null data.)
flagBooleanYtrue is to pause, or false is to cancel pausing.
Sample
input1.setEventPause("onclick", true); // Dynamically pauses the onclick event. input1.setEventPause("onfocus,onblur", false); // Restarts the onfocus and the onblur events. input1.setEventPause(null, true); // Pauses all user events registered for the Input component.
setNodeSet( nodeset , label , value )
Changes the itemset setting. When bound with a DataList, the nodeset must start with data: prefix.
Parameter
nametyperequireddescription
nodesetStringYAdd data: prefix (or the XPath of the instance data) to the Id of the DataList.
labelStringNID of the column to be used as the label. If not specified, the existing value will be used. (Or XPath under the nodeset to set for the label.)
valueStringNID of the column to be used as the value. If not specified, the existing value will be used. (Or XPath under the nodeset to set for the value.)
Sample
// Define a DataList as shown below. <w2:dataList id="dataList1"> <w2:columnInfo> <w2:column id="lbl" dataType="text"></w2:column> <w2:column id="code" dataType="text"></w2:column> </w2:columnInfo> <w2:data use="true"> <w2:row> <lbl><![CDATA[zero]]></lbl> <code><![CDATA[0]]></code> </w2:row> <w2:row> <lbl><![CDATA[one]]></lbl> <code><![CDATA[1]]></code> </w2:row> </w2:data> </w2:dataList> // Change the itemset of selectbox1 to dataList1 of the datacollection, the label to lbl column, and the value to code column. selectbox1.setNodeSet('data:dataList1','lbl','code'); // Change to dataList2 which has same columns with dataList1 but different data. selectbox1.setNodeSet('data:dataList2'); // Existing labels and values are maintained, and only dataList is changed.
setOpacity( value )
Sets the opacity of the component.
Parameter
nametyperequireddescription
valueNumberYOpacity value (A real number between 0 and 1)
Sample
componentId.setOpacity(0.45);
setPosition( left , top , mode )
Sets the position (left, top) of the component.
Parameter
nametyperequireddescription
leftNumberYLeft position or null.
topNumberYTop position or null.
modeStringN[defulat:absolute, delta] absolute sets the current positions as x and y, and delta adds x and y to the current positions.
Sample
// Set the top position of the component as 100 pixels. componentId.setPosition(null, 100);
setReadOnly( readOnly )
Controls the "readOnly" property. True to enable, or false to disable.
Parameter
nametyperequireddescription
readOnlyBooleanYTrue to enable, or false to disable.
Sample
// Enable the read-only. componentId.setReadOnly(true);
setRef( ref )
Dynamically sets the ref binding. Add data: prefix to bind with a DataCollection.
If not specified, XPath of the InstanceData will be used.
Parameter
nametyperequireddescription
refStringYref path
Sample
// Bind the hobby key in dataMap1 with the value of selectbox1. selectbox1.setRef("data:dataMap1.hobby"); // Bind with res/userData/hobby of the InstanceData. selectbox1.setRef("res/userData/hobby");
setSelectedIndex( idx )
Selects the item of the corresponding index. If the chooseOption or allOption is true, -All- or -Select- will be considered as an item and will be also included in index numbering.
Parameter
nametyperequireddescription
idxNumberYIndex of the item
Sample
// Set the chooseOption as shown below. <xf:select1 id="selectbox1" chooseOption="true" style="position: relative;width: 148px;height: 21px;"disabledClass=" w2selectbox_disabled" appearance="minimal" > <xf:choices> <xf:item> <xf:label><![CDATA[남성]]></xf:label> <xf:value><![CDATA[M]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[여성]]></xf:label> <xf:value><![CDATA[F]]></xf:value> </xf:item> </xf:choices> </xf:select1> selectbox1.setSelectedIndex(1); // Because the "chooseOption" is "true", the "Male" item will be selected.
setSize( width , heigth )
Sets the size (width, height) of the component.
Parameter
nametyperequireddescription
widthNumberYComponent width or null
heigthNumberYComponent height or null
Sample
// Set the component height as 100 pixels. componentId.setSize(null,100);
setStyle( propertyName , value )
Sets the style of the specified property.
Parameter
nametyperequireddescription
propertyNameStringYName of the style
valueStringYValue of the style
Sample
// Set the component width as 200px. componentId.setStyle("width", "200px"); // Change the background color to olive. componentId.setStyle("background-color","olive");
setText( lbl , isOriginal )
Selects an item of which label is same as the specified lbl value.
Parameter
nametyperequireddescription
lblStringYLabel of the item
isOriginalBooleanN[default:true, false] Sets the value with the original, an unformatted value. In case of true, a formatted value will be used. In case of false, an unformatted value will be used.
Sample
// The label is "Male". selectbox1.getText('Male');
setTitle( title )
Sets the title of the component.
Parameter
nametyperequireddescription
titleStringYProperty value
Sample
selectbox1.setTitle("test"); // The title property of selectbox1 will be "test".
setUserData( key , value )
Sets the user data in the component. If the key cannot be set for the component, corresponding logs will be displayed.
Parameter
nametyperequireddescription
keyStringYRandom data key
valueStringYRandom data key
Sample
// Setting a (key, value) pair of ("data", "WebSquare5") in the component. componentId.setUserData("data", "WebSquare"); // Some keys cannot be set for the component. componentId.setUserData("title", "WebSquare"); // (Log Example) !!!WARNING - [title] can't define as UserData
setValue( value )
Selects an item which contains the value received as a parameter, and sets the value in the selected item.
In case there is no item of the corresponding value, no operation will be made.
Parameter
nametyperequireddescription
valueStringYValue of the item
Return
typedescription
BooleanSetting result
Sample
// The label is "Male" and the value is "M". selectbox1.setValue("M"); // "Male" item will be selected.
show( displayType )
Displays the component.
The related CSS properties are display and visibility:show;.
Parameter
nametyperequireddescription
displayTypeStringN[default:block ,inline ,none ,""] Value of the Display property.
Sample
// Block the "display" property. componentId.show(); // Enable the "display" property in the class. componentId.show("");
showChooseOption( chooseOption )
Sets the chooseOption.
Parameter
nametyperequireddescription
chooseOptionbooleanYValue
Sample
selectbox1.showChooseOption(true);
toggleClass( className )
Removes a class named className, or if there is no such a class, adds a class named className.
In the default setting, only the classes added by addClass can be removed. To remove other classes, add the following setting in config.xml.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYclassName to set
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.toggleClass("tmpInputClass"); // Add tmpInputClass class again. input1.toggleClass("tmpInputClass");
trigger( type , array )
Triggers a certain event registered for the component.
Parameter
nametyperequireddescription
typeStringYName of the event to trigger
arrayArrayNArray of parameters to send to the event handler
Sample
// Trigger the onclick event in the input1 component. input1.trigger("onclick"); // Trigger the onviewchange event in the input component and call the event handler function by sending arguments of (1, 2). input1.trigger("onviewchange", [1,2]);
unbind( type , function )
Removes an event registered for the component.
Parameter
nametyperequireddescription
typeStringNName of the event to remove. If not specified, all events of the components will be removed.
functionFunctionNHandler function of the event to remove. If not specified, all handler functions of the event will be removed.
Sample
// Remove all events registered in the input component. input1.unbind(); // Remove all handler functions of onviewchange event registered in the input component. input1.unbind("onviewchange"); // Remove the func1 event handler of onviewchange event registered for component input1. input1.unbind("onviewchange", func1);
unbindRef( )
Releases the ref binding.
validate( )
Validates the component according to the specified properties.
Validation-related property: mandatory
Sample
// Set chooseOption and mandatory as shown below. <xf:select1 id="selectbox1" chooseOption="true" mandatory="true" style="position: relative;width: 148px;height: 21px;"disabledClass=" w2selectbox_disabled" appearance="minimal" > <xf:choices> <xf:item> <xf:label><![CDATA[남성]]></xf:label> <xf:value><![CDATA[M]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[여성]]></xf:label> <xf:value><![CDATA[F]]></xf:value> </xf:item> </xf:choices> </xf:select1> // The end user selected nothing. ("-Selected-" item is currently being displayed.) var returnValue = selectbox1.validate(); // (Return Example) false // If the "displaymessage" is "true", the WebSquare5 Engine will alert "Mandatory information" message.
validateObject( )
Validates the component according to the specified properties.
Related Properties : mandatory, minLength, maxLength, minByteLength, maxByteLength
(Version: Added in 5.0_1.2783B.20170908.145609.)
Return
typedescription
Objectobject validation result object
<String> object.callerId Validation target component ID <String> object.type Validation items <Boolean> object.value Validation result
Sample
// Set chooseOption and mandatory as shown below. <xf:select1 disabledClass="w2selectbox_disabled" appearance="minimal" direction="auto" chooseOption="true" id="selectbox1" style="position: absolute;width:229px;height:66px;left:692px;top:268px;" mandatory="true" chooseOptionLabel="-선택-"> <xf:choices> <xf:itemset nodeset="data:dataList3"> <xf:label ref="label"></xf:label> <xf:value ref="value"></xf:value> </xf:itemset> </xf:choices> </xf:select1> var returnObj = selectbox1.validateObject(); // Return - without a SelectBox value) An empty object will be returned. // Return - with a SelectBox value) returnObj will be returned. returnObj.callerId = "selectbox1" returnObj.type = "mandatory" returnObj.value = "" Alerts the defined message upon a validation failure in case the displaymessage is "true". // (Alert Example) This field is mandatory.
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.
Sets the visibility of the component style. In case of true, set visible. In case of false, set hidden.
Parameter
nametyperequireddescription
flagBooleanYVisibility (In case of true, set visible. In case of false, set hidden.)