PropertyEventMethodIndex
WebSquare.uiplugin.checkbox - 5.0_2.3750B.20190805.154938

Functions same as type="checkbox" in the input tag of HTML, and allows the end user to make multiple selections.
Note, however, that div tags, not input tags, are at the highest level. In order to use the input tag, make an additional setting.

Type

uiplugin

Property Summary

appearance
The appearance property of xforms select1
class
Provides a similar feature to the class in HTML. One or more classes defined in the CSS file or the style block can be used.
cols
Number of the columns to list items.
disabled
[default:false, true] Disabled status of the component.
displaymessage
[default:false, true] Displays the result message upon a validation failure by the validation API.
escape
Converts <>&" characters into HTML Escape characters.
falseValue
The value for the case when no item is selected.
id
Component ID
ignoreTabIndex
Ignores the focus upon tab moving.
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.
itemTagname
The tagname of the item when the renderType is checkboxgroup.
mandatory
[default:false, true] Mandatory field. The validation function checks mandatory input fields. (Options) "false" (Default) Not make it mandatory. "true" Make it mandatory. </xmp></xmp>
nextTabID
The ID of the component to be selected upon the end user’s pressing the Tab key.
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
renderType
[default:table, native, checkboxgroup] Decides the the layout structure rendering method.
rows
Number of the rows to show the items. For example, value 2 means that the items will be displayed on two rows.
selectedindex
Index of the default selection. Functions only when the index is hard-coded or pre-defined in the DataList.
separator
Separator to divide multiple selections
tabIndex
The focusing order by the Tab key.
tagname
The tagname of the object to be rendered when the renderType is checkboxgroup.
title
Same as the class property in HTML.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component.
tooltipClass
Name of the style class to apply to the tooltip
tooltipDisplay
[default:false, true] Displays tooltip based on the user’s selection.
tooltipItemLabel
Displays the tooltip upon user’s hovering the mouse over each checkbox item when tooltipDisplay is "true" and tooltipItemLabel is "tooltip".
tooltipTime
Tooltip display time. (Unit: second)
useCheckboxTitle
[default:true, false] Display of the title on the checkbox button for web accessibility
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
validator
Name of the validation function

Event Summary

onchange
Triggered upon the end user's selecting/changing an item or setting a value. Use the onviewchange event to control only the end user's selecting an item.
oncheckboxclick
Triggered upon the end user's clicking a checkbox, not a label.
onlabelclick
Triggered upon the end user's clicking a label, not a checkbox.
onviewchange
Triggered when the value on the list is changed through keyboard input or mouse clicking.

Method Summary

addClass( className )
Adds a CSS class to the component.
addItem( value , label , index )
Adds an item. If the index is not specified, the item will be added as a sub-item.
bind( eventType , function )
Dynamically allocate an event and the handler function to the component.
changeClass( oldClassName , newClassName )
Changes the class currently applied to the corresponding WebSquare component. (Supported in all WebSquare components.)
checkAll( checkFlag )
Checks or unchecks all items.
click( index )
Functions same as clicking of an item of the corresponding index. Selects/Unselects the item.
deleteItem( index )
Deletes the item of the corresponding index.
focus( )
Moves the focus to the component.
getDataListInfo( )
Returns the dataList bound with the component.
getDisabled( )
Returns the current value of the disabled property.
getGenerator( )
In case generated by the Generator component, returns the parent Generator object that created the component itself.
getID( )
Returns the ID of the WebSquare component.
getInitStyle( CSS )
Returns the initial style of the WebSquare component.
getItemCount( )
Returns the number of the items.
getItemDisabled( index )
Returns the disabled status of the item of the corresponding index.
getNextTabID( )
Returns the nextTabID value.
getOpacity( )
Returns the opacity of the WebSquare component. (Supported in all WebSquare components.)
getOriginalID( )
Returns the originalID of the WebSquare component. (Supported in all WebSquare components.)
getPluginName( )
Returns the name of the WebSquare component.
getPosition( positionName )
Returns the position (left and top) of the WebSquare component.
getScope( )
For the child component of a scope="true" WFrame, returns the parent WFrame object. (Supported in all WebSquare components.)
getScopeWindow( )
For the child component of a scope="true" WFrame, returns the parent WFrame object. (Supported in all WebSquare components.)
getSelectedIndex( separator )
Returns the index of the selected item. Multiple indices can be returned through the use of a separator.
getSize( sizeName )
Sets the size (width, height) of the WebSquare component.
getStyle( propertyName )
Returns the CSS setting of the WebSquare component.
getStyleValue( style )
[deprecated]
getText( separator )
Gets the label of the currently selected item. For multiple items, uses a separator.
getTitle( )
Returns the title of the WebSquare component.
getUdcHome( )
Returns the path of the UDC file including the file name in which the UDC object is defined. (Supported in all WebSquare components.)
getUdcRoot( )
Returns the path of the UDC file in which the UDC object is defined. (Supported in all WebSquare components.)
getUserData( key )
Returns the value set by setUserData or directly defined by the user in the XML file.
getValue( separator )
Gets the value of the currently selected item. Uses a separator for multiple values.
hasClass( className )
Checks whether the WebSquare component has a certain class.
hide( )
Hides the WebSquare component. (Supported in all WebSquare components.)
removeAll( )
Removes all items.
removeClass( className )
Removes a class from the WebSquare component. (Supported in all WebSquare components.)
reset( )
Unchecks all items.
setDisabled( disabled )
Sets the disabled property.
setEventPause( evList , flag )
Pauses the event.
setInitStyle( property )
Restores the initial style of the WebSquare component.
setItemDisabled( index , flag )
Disables or enables the item of the corresponding index.
setNextTabID( componentID , componentScope )
Sets the nextTabID property.
setNodeSet( nodeset , label , value )
Sets the selection item list.
setOpacity( value )
Sets the opacity in the WebSquare component. (Supported in all WebSquare components.)
setPosition( left , top , mode )
Sets the position (left, top) of the WebSquare component.
setRef( title )
Sets the ref property. Add “data:” prefix to bind with a DataCollection.
setSelectedIndex( index )
Checks/Unchecks (or toggles) the item of the corresponding index.
setSize( width , height )
Sets the size (width, height) of the WebSquare component.
setStyle( propertyName , value )
Sets the CSS of the WebSquare component.
setUserData( key , value )
Sets random data in the WebSquare component.
setValue( value )
Selects an item which contains the value received as a parameter, and sets the value in the selected item.
show( displayType )
Shows the WebSquare component on the page. (Supported in all WebSquare components.)
toggleClass( className )
Adds or removes a CSS class to or from a WebSquare component. (Supported in all WebSquare components.)
trigger( type , array )
Triggers the specified event in the WebSquare component.
unbind( type , function )
Removes the specified event from the WebSquare 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]

Property Detail

appearance
The appearance property of xforms select1
class
Provides a similar feature to the class in HTML. One or more classes defined in the CSS file or the style block can be used.
The WebSquare5 Engine has a dedicated class to each component. Using the class of the component, the developer can apply a common CSS.
cols
Number of the columns to list items.
disabled
[default:false, true] Disable the component. (Options) "false" (Default) Not disable the component. "true" Disable the component.
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.
escape
Converts <>&" characters into HTML Escape characters. (Options) "false" (Default) Converts into HTML Escape characters. "true" Not convert into HTML Escape characters.
falseValue
The value for the case when no item is selected.
When not selected, the value will be " " (empty string.) Otherwise, the corresponding value of the property will be returned.
id
Component ID
The component ID is allocated as a global object. The script can access each object through the component ID.
ignoreTabIndex
Ignores the focus upon tab moving.
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."; } }
itemTagname
The tagname of the item when the renderType is checkboxgroup.
mandatory
[default:false, true] Mandatory field. The validation function checks mandatory input fields. (Options) "false" (Default) Not make it mandatory. "true" Make it mandatory.
(Related Function) validate();
nextTabID
The ID of the component to be selected upon the end user’s pressing the Tab key.
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:table, native, checkboxgroup] Decides the the layout structure rendering method.
table : Uses table tag under div tag, not input tag.
native : <input type="checkbox"> Create label tag using the TextBox component. Mandatory when the title property is not used (to comply with web accessibility requirements).
checkboxgroup : Allows the developer to decide the tag. The default is div tag. Set the highest-level tag and other tags using tagname and itemTagname properties.
rows
Number of the rows to show the items. For example, value 2 means that the items will be displayed on two rows.
selectedindex
Index of the default selection. Functions only when the index is hard-coded or pre-defined in the DataList.
Note that the default selection is made when the component is initially rendered on the browser. After items are added after browser loading or once data is allocated to the DataList after data submission, this property will not be valid.
separator
If not specified, space will be used as the delimiter.
tabIndex
The focusing order by the Tab key.
Same as the tabindex property in HTML.
tagname
The tagname of the object to be rendered when the renderType is checkboxgroup.
title
Same as the title property in HTML. The title is displayed upon the end user’s moving the mouse over the component. Generally used to support web accessibility.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component. Displayed upon mouse-over.
tooltipClass
Name of the style class to apply to the tooltip Valid in case of tooltipDisplay="true". (Related Property) tooltipDisplay="true"
tooltipDisplay
[default:false, true] Displays tooltip based on the user’s selection. (Options) "true" Display tooltip. "false" (Default) Not display tooltip.
tooltipItemLabel
Displays the tooltip upon user’s hovering the mouse over each checkbox item when tooltipDisplay is "true" and tooltipItemLabel is "tooltip".
Displays the “tooltip” set in the tooltipItemLabel. In case of tooltipItemLabel = "",
displays the label of the checkbox item as the tooltip..
tooltipTime
Tooltip display time. (Unit: second)
Valid in case of tooltipDisplay="true". (Related Property) tooltipDisplay="true"
useCheckboxTitle
[default:true, false] Display of the title on the checkbox button for web accessibility
useLocale
[default:false, true] True to use the multi-language key to display the labels on the WebSquare5 client.
userData1
User-defined property. Use getUserData("userData3") to get the data. // Example getUserData("userData1");
userData2
User-defined property. Use getUserData("userData2") to get the data. // Example getUserData("userData2");
userData3
User-defined property. Use getUserData("userData3") to get the data. // Example getUserData("userData3");
validator
Name of the validation function

Event Detail

onchange
Triggered upon the end user's selecting/changing an item or setting a value. Use the onviewchange event to control only the end user's selecting an item.
The event handler (this function) can access the component. (Example) this.getValue();
oncheckboxclick
Triggered upon the end user's clicking a checkbox, not a label.
The event handler (this function) can access the component. (Example) this.getValue();
Parameter
nametypedescription
indexStringIndex of the triggered item
checkedbooleanChecked status of the triggered item
valueStringValue of the triggered item
Sample
<script ev:event="oncheckboxclick( index, checked, value )"><![CDATA[ var itemIndex = index; //item의 index var itemChecked = checked; //item의 선택 여부 var itemValue = value; //item의 value var compValue = this.getValue(); //컴포넌트의 value ]]></script>
onlabelclick
Triggered upon the end user's clicking a label, not a checkbox.
The event handler (this function) can access the component. (Example) this.getValue();
Parameter
nametypedescription
indexStringIndex of the triggered item
checkedbooleanChecked status of the triggered item
valueStringValue of the triggered item
Sample
<script ev:event="onlabelclick( index, checked, value )"><![CDATA[ var itemIndex = index; //item의 index var itemChecked = checked; //item의 선택 여부 var itemValue = value; //item의 value var compValue = this.getValue(); //컴포넌트의 value ]]></script>
onviewchange
Triggered when the value on the list is changed through keyboard input or mouse clicking.
Parameter
nametypedescription
infoJSONReturns an object containing index, checked, and value. <Number> info.index : Index of the triggered item <Boolean> info.checked : Checked status of the triggered item <String> info.value : Value of the triggered item
Sample
<script ev:event="onviewchange( info )"><![CDATA[ var itemIndex = info.index; //item의 index var itemChecked = info.checked; //item의 선택 여부 var itemValue = info.value; //item의 value var compValue = this.getValue(); //컴포넌트의 value ]]></script>

Method Detail

addClass( className )
Adds a CSS class to the component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
classNameStringYName of the class to add
Sample
// (Example) Add oddClass to input1 component. input1.addClass("oddClass");
addItem( value , label , index )
Adds an item. If the index is not specified, the item will be added as a sub-item.
Parameter
nametyperequireddescription
valueStringYValue of the item
labelStringYLabel of the item
indexNumberNIndex of the item
Return
typedescription
NumberIndex of the added item
Sample
// Hard-code as shown below. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue = checkbox1.addItem( '3', 'ornage' ); // (Return Example) 2
bind( eventType , function )
Dynamically allocate an event and the handler function to the component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
eventTypeStringYEvent to allocate
functionFunctionYHandler function of the event
Sample
// (Example 1) // Define a function for the onclick event of input1. input1.bind("onclick", function(e){ alert(input1.getValue();})); // (Example 2) // Define commObj.ev_click function in advance. var commObj = {}; commObj.ev_click = function(e){ alert("click :: "+this.id); }; // Dynamically allocate onclick event and the handler function to input1 component. input1.bind("onclick", commObj.ev_click );
changeClass( oldClassName , newClassName )
Changes the class currently applied to the corresponding WebSquare component. (Supported in all WebSquare components.)
Only the classes added by addClass can be changed.
In order to remove classes directly defined in the class propert of the WebSquare component, add the following in config.xml. // Add the following in config.xml.
Parameter
nametyperequireddescription
oldClassNameStringYClass to change
newClassNameStringYClass to newly use
Sample
// The class is directly defined in the inputBox component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following in config.xml. <style> <removeDefaultClass value="true" /> </style> // The class can be changed. (Change the class from tmpInputClass to tmpInputWarninClass.) input1.changeClass("tmpInputClass","tmpInputWarninClass");
checkAll( checkFlag )
Checks or unchecks all items.
Parameter
nametyperequireddescription
checkFlagBooleanYtrue is to check all, or false is to uncheck all.
Sample
// Check all. checkbox1.checkAll(true); // Uncheck all. checkbox1.checkAll(false);
click( index )
Functions same as clicking of an item of the corresponding index. Selects/Unselects the item.
Other events such as the onviewchange may be also triggered.
Parameter
nametyperequireddescription
indexNumberYIndex of the item to trigger a click event
Sample
// Trigger a click event for the first item. checkbox1.click(0); // Select/Unselect all.
deleteItem( index )
Deletes the item of the corresponding index.
Parameter
nametyperequireddescription
indexNumberNIndex of the item to delete
Return
typedescription
JSONJSON containing information of the deleted item
<String> label : Label of the item <String> value : Value of the item
Sample
// Hard-code as shown below. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue = checkbox1.deleteItem( 0 ); // (Return Example) {label: "Apple", value: "1"}
focus( )
Moves the focus to the component.
getDataListInfo( )
Returns the dataList bound with the component.
Return
typedescription
ObjectReturns nodeset, label, and value id as an object.
Sample
// Example checkbox1.getDataListInfo();
getDisabled( )
Returns the current value of the disabled property. (Supported in all WebSquare components.)
Return
typedescription
BooleanValue of the disabled property
Sample
// (Example) Check the current value of the disabled property. var returnValue = componentId.getDisabled(); // (Return) false
getGenerator( )
In case generated by the Generator component, returns the parent Generator object that created the component itself. (Supported in all WebSquare components.)
Return
typedescription
ObjectParent Generator object
Sample
// (Example) The Generator (parent) create a Trigger (child). <w2:generator id="generator1"> <w2:trigger id="trigger1" ev:onclick="scwin.trigger1_onclick"></w2:trigger></w2:generator> // In the example below, upon the end user’s clicking the Trigger 1, the generator1 object will be displayed on the console. scwin.trigger1.onclick = function(){ console.log(this.getGenerator());}
getID( )
Returns the ID of the WebSquare component. (Supported in all WebSquare components.)
Return
typedescription
StringWebSquare component ID
Sample
// Upon dynamically receiving a WebSquare component, the ID can be checked as shown below. function fn_validCheck(tmpObj){ var compID = tmpObj.getID(); } // If the tmpObj in the above example has "input1" ID. // (Return) "input1"
getInitStyle( CSS )
Returns the initial style of the WebSquare component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
CSSStringNProperty (If not specified, all properties will be displayed.)
getItemCount( )
Returns the number of the items.
Return
typedescription
NumberNumber of the items
Sample
// When there are total two items var returnValue = checkbox1.getItemCount(); // (Return Example) 2
getItemDisabled( index )
Returns the disabled status of the item of the corresponding index.
Parameter
nametyperequireddescription
indexNumberYIndex of the item
Return
typedescription
BooleanDisabled status of the item
Sample
// Get the disabled status of the first item which is enabled. var returnValue = checkbox1.getItemDisabled(0); // (Return Example) false
getNextTabID( )
Returns the nextTabID value. (Related Property) nextTabID
Sample
// Example var nextTabID = checkbox1.getNextTabID();
getOpacity( )
Returns the opacity of the WebSquare component. (Supported in all WebSquare components.)
The Engine returns the opacity value of the CSS.
Return
typedescription
IntegerOpacity
Sample
// Apply the opacity CSS to the InputBox component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;opacity:0.2;"></xf:input> // Return the opacity of the InputBox. var returnValue = input1.getOpacity(); // A real number between 0 and 1 will be returned. // (Return) "0.2"
getOriginalID( )
Returns the originalID of the WebSquare component. (Supported in all WebSquare components.)
The originalID is valid when the scope function is in use.
For scope="true" WFrame, component IDs inside the WFrame is changed with the prefix(wframeID + "_") being added before the ID given by the user (originalID).
The originalID means the ID before the prefix being added.
Return
typedescription
StringoriginalID of the component
Sample
// An example of multi-WFrame page // Main page with a WFrame (main.xml) <w2:wframe id="wframe1" src="text.xml" scope="true"/> // Source page to be contained in the WFrame (text.xml) <w2:textbox id="textbox1"/> // (Example) Check the Id and the original ID in the script of text.xml // Run getID. textbox1.getID(); // "wframe1_textbox1" is returned. // Run getOriginalID. textbox1.getOriginalID(); // "textbox1" is returned.
getPluginName( )
Returns the name of the WebSquare component. (Supported in all WebSquare components.)
Return
typedescription
StringName of the WebSquare component (pluginName)
Sample
// When a common function dynamically receives a WebSQuare object as shown below, different actions can be made for each component type. var commObj = {}; commObj.fn_makeReqData = function(tmpObj){ var tmpID = tmpObj.getID(); // Component ID var tmpCompType = tmpObj.getPluginName(); // Component name if(tmpCompType == "input"){ //..Logic.. }else if(tmpCompType == "gridView"){ //..Logic .. }else{ //..Logic.. } };
getPosition( positionName )
Returns the position (left and top) of the WebSquare component. (Supported in all WebSquare components.) When the position is set in 0%, the value will be converted into %.
Parameter
nametyperequireddescription
positionNameStringY[left, top] Position type
Return
typedescription
NumberPosition of the component
Sample
// CSS margin is applied to the Input component as shown below. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin:10px;"></xf:input> // (Example) Check the top value of the InputBox. var returnValue = input1.getPosition("top"); // Position value in pixels will be returned. // (Return) 10
getScope( )
For the child component of a scope="true" WFrame, returns the parent WFrame object. (Supported in all WebSquare components.)
For scope="true" WFrame, null will be returned.
Return
typedescription
ObjectWFrame object or null
Sample
// (Example) // The main page has wframe1 which contains wframe1 which also contains wframe11. // The source page of wframe11 has textbox1. textbox1.getScope(); // (Return Example) wframe11 object
getScopeWindow( )
For the child component of a scope="true" WFrame, returns the parent WFrame object. (Supported in all WebSquare components.)
If not a child of a scope="true" WFrame, a global window object will be returned.
Return
typedescription
ObjectScope object of the WFrame or a global window object
Sample
// (Example) // The main page has wframe1 which contains wframe1 which also contains wframe11. // The source page of wframe11 has textbox1. var scope = textbox1.getScopeWindow(); scope.wframe11 === textbox1.getScope(); // true
getSelectedIndex( separator )
Returns the index of the selected item. Multiple indices can be returned through the use of a separator.
If not specified, space will be used as the delimiter.
Parameter
nametyperequireddescription
separatorStringNSeparator
Return
typedescription
StringString containing the index of the selected item.
Sample
// The component is defined, and Apple and Orange are selected. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[오렌지]]></xf:label> <xf:value><![CDATA[3]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue1 = checkbox1.getSelectedIndex(); // (Return Example) "0 2" // The comma is used as the separator. var returnValue2 = checkbox1.getSelectedIndex(","); // (Return Example) "0,2"
getSize( sizeName )
Sets the size (width, height) of the WebSquare component. (Supported in all WebSquare components.) If set in %, the value will be converted into pixels.
Parameter
nametyperequireddescription
sizeNameStringY[height, innerHeight, outerHeight, outerMarginHeight, width, innerWidth, outerWidth, outerMarginWidth] Position type. For the details, 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"); // (Return Example) 100 // Values are in pixels. // If set in %, values will be converted into pixels.
getStyle( propertyName )
Returns the CSS setting of the WebSquare component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
propertyNameStringYCSS property to return
Return
typedescription
StringCSS value
Sample
// Define an Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;"></xf:input> // (Example) Check the width of the InputBox above. var returnValue = input1.getStyle("width"); // (Return) "144px"
getStyleValue( style )
[deprecated]
Use getStyle instead.
Returns the current CSS applied to the WebSquare component.
Parameter
nametyperequireddescription
styleStringYCSS property to return
Return
typedescription
StringCSS value (Colors are returned in HexCode.)
getText( separator )
Gets the label of the currently selected item. For multiple items, uses a separator.
If not specified, space will be used as the delimiter.
Parameter
nametyperequireddescription
separatorStringNSeparator
Return
typedescription
StringString containing labels of the selected items
Sample
// The component is defined, and Apple and Orange are selected. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[오렌지]]></xf:label> <xf:value><![CDATA[3]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue = checkbox1.getText(); // (Return Example) "Apple Orange" // Use the separator. var returnValue = checkbox1.getText(","); // (Return Example) "Apple,Orange"
getTitle( )
Returns the title of the WebSquare component. (Supported in all WebSquare components.)
Return
typedescription
StringTitle
Sample
// In the following example, the Title is “Input Name”. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" title="이름 입력"></xf:input> var tmpTitle = input1.getTitle(); // (Return Example ) "Input Name"
getUdcHome( )
Returns the path of the UDC file including the file name in which the UDC object is defined. (Supported in all WebSquare components.)
The file name includes .xml. In order to get the file path without .xml, use getUdcRoot.
When called by a WebSquare component, not a UDC object, “undefined” will be returned.
Return
typedescription
StringUDC file path (For others than the UDC, undefined will be returned.)
Sample
// Example // UDC file path is /a/b/udc.xml. // Page XML is /a/c/main.xml. // UDC ID is udc1. udc1.getUdcHome(); // (Result) /a/b/udc.xml
getUdcRoot( )
Returns the path of the UDC file in which the UDC object is defined. (Supported in all WebSquare components.)
Not contains the file name. In order to get a path including the file name, use getUdcHome.
When called by a WebSquare component, not a UDC object, “undefined” will be returned.
Return
typedescription
StringUDC file path (For others than the UDC, undefined will be returned.)
Sample
// Example // UDC file path is /a/b/udc.xml. // Page XML is /a/c/main.xml. // UDC ID is udc1. udc1.getUdcHome(); // (Execution Result) /a/b/
getUserData( key )
Returns the value set by setUserData or directly defined by the user in the XML file. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
keyStringYData key
Return
typedescription
StringValue for the given key
Sample
// (Example) Setting the user property (setTest) in the InputBox <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" setTest="Hello"></xf:input> // Returns the value of the setTest property. input1.getUserData("setTest"); // (Reurn) "Hello" // Set 'valueTest' (key) and 'WebSquare' (data) through setUserData. input1.setUserData("valueTest","WebSquare"); // Returns the value of the setTest property. input1.getUserData("WebSquare"); // (Return) "WebSquare"
getValue( separator )
Gets the value of the currently selected item. Uses a separator for multiple values.
If not specified, space will be used as the delimiter.
Parameter
nametyperequireddescription
separatorStringNSeparator
Return
typedescription
StringString containing the values of the selected items.
Sample
// The component is defined, and Apple and Orange are selected. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[오렌지]]></xf:label> <xf:value><![CDATA[3]]></xf:value> </xf:item> </xf:choices> </xf:select> var returnValue = checkbox1.getValue(); // (Return Example) "1 3"
hasClass( className )
Checks whether the WebSquare component has a certain class. (Supported in all WebSQuare components.)
Parameter
nametyperequireddescription
classNameStringYName of the class to check
Return
typedescription
BooleanWhether the class exists or not
Sample
// The class is directly defined in the inputBox component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> var returnValue = input1.hasClass("tmpInputClass"); // (Return) true
hide( )
Hides the WebSquare component. (Supported in all WebSquare components.)
display:none; or visibility:hidden; CSS is applied.
Sample
// (Example) Hide the component. componentId.hide();
removeAll( )
Removes all items.
Sample
checkbox1.removeAll();
removeClass( className )
Removes a class from the WebSquare component. (Supported in all WebSquare components.)
Only the classes added by addClass can be removed.
In order to remove classes directly defined as a property of the component, add the following in config.xml. // Add the following in config.xml. <style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYName of the class to remove
Sample
// If the class is directly defined as an InputBox property. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // In the config.xml file, add the following. <style> <removeDefaultClass value="true" /> </style> // Classes can be removed by removeClass. input1.removeClass("tmpInputClass");
reset( )
Unchecks all items.
Sample
// Uncheck all. checkbox1.reset();
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 )
Pauses the event. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
evListStringNList of the events to pause. (in case of null, all events of the corresponding WebSquare component is paused or restarted.)
flagBooleanYWhether to pause the event or not. (true: Pause. false: Restart.)
Sample
// (Example 1) // Pause the onclick event. input1.setEventPause("onclick", true); // (Example 2) // Restart the onfocus and the onblur events. input1.setEventPause("onfocus,onblur", false); // (Example 3) // Pause all events registered in input1. input1.setEventPause(null, true);
setInitStyle( property )
Restores the initial style of the WebSquare component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
propertyStringNCSS property (If not spcified, all properties will be restored.)
Sample
// (Example) group1.setInitStyle();
setItemDisabled( index , flag )
Disables or enables the item of the corresponding index.
Parameter
nametyperequireddescription
indexNumberYIndex of the item
flagBooleanYDisabled status
Sample
// Disable the first item. checkbox1.setItemDisabled(0, true); // The item cannot be selected or unselected.
setNextTabID( componentID , componentScope )
Sets the nextTabID property.
When the ID of the frame in which the nextTabID, the second argument, is given, the scope can be set. (Related Property) nextTabID
Parameter
nametyperequireddescription
componentIDStringYComponent ID to set as the nextTabID
componentScopeStringNComponent scope to set as the nextTabID
Sample
// Example checkbox1.setNextTabID("input2", "wframe1");
setNodeSet( nodeset , label , value )
Sets the selection item list.
When bound with the DataList, the nodeset parameter must start with "data:".
Parameter
nametyperequireddescription
nodesetStringYDataList ID. Must start with "data:". (Or XPath of the InstanceData)
labelStringNColumn ID to set as the label. If no value is allocated, the existing value will be applied. (Or XPath under the nodeset to set as the label.)
valueStringNColumn ID to set as the value. If no value is allocated, the existing value will be applied. (Or XPath under the nodeset to set as 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 checkbox1 into dataList1 of the DataCollection, and set the label as lbl column and value as code column. checkbox1.setNodeSet('data:dataList1','lbl','code'); // Change to dataList2 which has same columns with dataList1 but different data. checkbox1.setNodeSet('data:dataList2'); // Existing labels and values are maintained, and only dataList is changed.
setOpacity( value )
Sets the opacity in the WebSquare component. (Supported in all WebSquare components.)
The engine sets the opacity property (of CSS).
Parameter
nametyperequireddescription
valueNumberYOpacity (Real number between 0 and 1)
Sample
// (Example) Set the opacity as 0.45. componentId.setOpacity(0.45);
setPosition( left , top , mode )
Sets the position (left, top) of the WebSquare component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
leftNumberYLeft position value or null
topNumberYTop position value or null
modeStringN[default: absolute, delta]
absolute (Default) : The inputted value becomes the position. delta : The inputted value is added to the current position.
Sample
// (Example) Set the top position as 100px. componentId.setPosition(null, 100);
setRef( title )
Sets the ref property. Add “data:” prefix to bind with a DataCollection.
If not specified, XPath of the InstanceData will be used.
Parameter
nametyperequireddescription
titleStringYPath of ref
Sample
// Bind hobby key of dataMap1 with the checkcombobox1 component. checkbox1.setRef("data:dataMap1.hobby"); // Bind with res/userData/hobby of the InstanceData. checkbox1.setRef("res/userData/hobby");
setSelectedIndex( index )
Checks/Unchecks (Toggles) the corresponding item of the specified index.
Parameter
nametyperequireddescription
indexNumberYIndex of the item
Sample
// Checks (or unchecks) the first item. checkbox1.setSelectedIndex(0);
setSize( width , height )
Sets the size (width, height) of the WebSquare component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
widthNumberYWidth of the component or null.
heightNumberYHeight of the component or null.
Sample
// (Example) Set the height of the component as 100px. componentId.setSize(null,100);
setStyle( propertyName , value )
Sets the CSS of the WebSquare component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
propertyNameStringYCSS property to set.
valueStringYValue to set as the specified CSS property
Sample
// (Example 1) Set the width as 200px. componentId.setStyle("width", "200px"); // (Example 2) Set the background as olive. componentId.setStyle("background-color","olive");
setUserData( key , value )
Sets random data in the WebSquare component. (Supported in all WebSquare components.) Enter key values supported by the component. In case a key value not supported by the component is entered, corresponding logs will be displayed.
Parameter
nametyperequireddescription
keyStringYData key to set
valueStringYDefined data value
Sample
// Set 'data' key and 'WebSquare' value in the component. componentId.setUserData("data", "WebSquare"); // The key must be supported in the component. componentId.setUserData("title", "WebSquare"); // Following logs will be displayed. // !!!WARNING - [title] can't be defined as UserData.
setValue( value )
Selects an item which contains the value received as a parameter, and sets the value in the selected item.
For multiple items, use a separator. If there is no item for the given value, no action will occur.
Parameter
nametyperequireddescription
valueStringYValue of the item
Sample
// The component is defined, and Apple and Orange are selected. <xf:select id="checkbox1" appearance="full" style="position: relative;" selectedindex="-1" > <xf:choices> <xf:item> <xf:label><![CDATA[사과]]></xf:label> <xf:value><![CDATA[1]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[체리]]></xf:label> <xf:value><![CDATA[2]]></xf:value> </xf:item> <xf:item> <xf:label><![CDATA[오렌지]]></xf:label> <xf:value><![CDATA[3]]></xf:value> </xf:item> </xf:choices> </xf:select> checkbox1.setValue("2"); // Cherry will be checked. checkbox1.setValue("0 2"); // Apple and Orange will be checked.
show( displayType )
Shows the WebSquare component on the page. (Supported in all WebSquare components.)
Sets the display property as specified and applies "visibility: show;" CSS.
Parameter
nametyperequireddescription
displayTypeStringN[default: block, inline, none, ""] CSS display setting.
block : display: block; inline : display: inline; none : display: none; "" : Restores to the previous display setting.
Sample
// (Example) display: block; componentId.show(); // (Example) Restore the previous display setting. componentId.show("");
toggleClass( className )
Adds or removes a CSS class to or from a WebSquare component. (Supported in all WebSquare components.)
Removes the class from the WebSquare component.
If the WebSquare component does not have the specified class, adds the class.
Only the classes added by addClass can be removed.
In order to remove classes directly defined as a property of the component, add the following in config.xml. // Add the following in config.xml. <style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYClass to add or remove
Sample
// The class is directly defined in the inputBox component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following in config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.toggleClass("tmpInputClass"); // Add the (previously removed) tmpInputClass. input1.toggleClass("tmpInputClass");
trigger( type , array )
Triggers a certain event in the component. (Supported in all WebSquare components.)
Parameter
nametyperequireddescription
typeStringYEvent to trigger
arrayArrayNArray of parameters to send to the event handler
Sample
// (Example 1) // Trigger the onclick event in input1 component. input1.trigger("onclick"); // (Example 2) // Trigger the onviewchange event in input1, and send (1, 2) parameter to the handler function. input1.trigger("onviewchange", [1,2]);
unbind( type , function )
Removes the event from the component. (Supported in all WebSquare component.)
Parameter
nametyperequireddescription
typeStringNEvent to remove. (If not specified, all events of the component will be removed.)
functionFunctionNHandler function of the event to remove. (If not specified, all handler functions of the event will be removed.)
Sample
// (Example 1) // Remove all events registered in the input1 component. input1.unbind(); // (Example 2) // Remove all handler functios for the onviewchange event of the input1 component. input1.unbind("onviewchange"); // (Example 3) // Remove func1 for the onviewchange event of the input1 component. input1.unbind("onviewchange", func1);
unbindRef( )
Releases the ref binding.
validate( )
Validates the component according to the specified properties.
Validation-related property: mandatory
Return
typedescription
BooleanValidation result
Sample
// All items are unselected. var returnValue = checkbox1.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
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 mandatory properties in the CheckBox component as shown below. <xf:select appearance="full" id="checkbox1" style="position: absolute;width:256px;height:79px;left:68px;top:254px;" mandatory="true"> <xf:choices> <xf:itemset nodeset="data:dataList1"> <xf:label ref="label"></xf:label> <xf:value ref="value"></xf:value> </xf:itemset> </xf:choices> </xf:select> var returnObj = checkbox1.validateObject(); // Return Example, when there is no CheckBox value, returnObj will be returned. returnObj.callerId = "checkbox1" returnObj.type = "mandatory" returnObj.value = "" // Return Example - When there is a CheckBox value, an empty object will be returned. Set displaymessage as true to alert a message defined in the WebSquare5 Engine upon a validation failure. //// (Alert Example) This field is mandatory.
visible( flag )
[deprecated]
Use show/hide or setStyle instead.
The Engine sets the CSS visibility property.
Parameter
nametyperequireddescription
flagBooleanYCSS visibility setting
true : visibility: visible; false : visibility: hidden;