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

Provides interfaces similar to <input type="text" > of the HTML.
In addition to creating the basic Text input features, the developer can also define display formats, prohibits certain characters from being entered and validates the input.

Type

uiplugin

Property Summary

adjustMaxLength
Adjusts the maxLength if the dataType is number and the data starts with - or +.
allowChar
Characters to allow. Implemented by RegExp of JavaScript. Korean/Chinese characters are applied upon blurring.
applyFormat
The application range of the formatted value. In case of all, the value and the displayed value will be the same and the displayed value will be formatted during the input.
autoFocus
When the maxByteLength is reached with the nextTabID being defined, automatically moves the focus.
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).
customModelFormatter
[default: ""] User-defined function executed before the data is saved in the dataCollection bound with the component.
customModelUnformatter
[default: ""] User-defined function to be executed upon the data being read from the dataCollection bound with the component.
dataType
[default:text, number, float, date, time, bigDecimal,euro] Data type of the component value. Referred to by other properties such as displayFormat.
disabled
[default:false, true] Disabled status of the component.
displayFormat
Formats the values same as in Excel file. Depends on the dataType defined in the Engine.
displayFormatter
Name of the function that format the component value.
displaymessage
[default: false, true] Displays the result upon a validation failure.
editType
[default:select, focus] Defines the action to be triggered upon the end user’s clicking the component.
enterBlur
[default:true, false] Blurs and generates the blur event upon the end user's pressing the Enter key.
escape
[true, false] Converts <>&" into HTML Escape characters.
euroMask
[default: ""] Masking value to be applied when the dataType is "euro" or when the changeCurrency API is used.
fireEventOnInvalid
[default:false] Fires the event upon a validation failure.
id
Component ID
ignoreChar
Characters to ignore. Implemented in RegExp of JavaScript. Specified Korean/Chinese characters will be ignored upon blurring.
imeMode
Sets the ime-mode (CSS).
initValue
Initial value set for the Input component
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.
ioFormat
[defulat:yyyyMMdd] Converts the input.de by the end user according to the specified format.
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>
maskFormat
[default: ""] Provides a similar feature to that of jQuery Mask plug-in. Changes numeric characters instead of #.
maskFormatModelExcludeChar
Specifies the characters to exclude from the bound DataCollection when using the maskFormat.
maxByteLength
Maximum input length in bytes. The exceeding characters will be automatically cut.
maxlength
Maximum input length. Exceeding characters will be automatically cut.
minByteLength
Checks the minimum byte length upon calling of the validation API.
minlength
Checks the minimum length upon calling of the validation API.
nextTabByEnter
Allows the Enter key to function same as the Tab key when the nextTabID is given. Upon the end user’s pressing the Enter key, the focus will move to the nextTabID component.
nextTabID
The ID of the component to be selected upon the end user’s pressing the Tab key.
numberMask
[default: ""] Masking value to be applied when the dataType is "number" or when the changeCurrency API is used.
onFocusClass
Name of the class to apply upon onFocus.
placeholder
Hint for the end users. Functions same as the placeholder of HTML5.
preventCopyPaste
[default:false, true] Prevents component values from being copied-and-pasted.
readOnly
[default:false, true] Setting of the readOnly property. Functions same as the readOnly of the HTML.
readOnlyClass
Name of the class to apply for readOnly mode.
readOnlyFocusEvent
[default:false, true] Generates focus event when the input object is readOnly.
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
refSync
[default:false, true] Refreshes the ref as soon as the key of the ref bound with the input is entered.
rupeeMask
[default: ""] Masking value to be applied when the dataType is "rupee" or when the changeCurrency API is used.
showPlaceHolderOnReadOnly
Displays the placeholder in the readOnly mode (readOnly="true").
tabIndex
The focusing order by the Tab key.
tengeMask
[default: ""] Masking value to be applied when the dataType is "tenge" or when the changeCurrency API is used.
title
Same as the class property in HTML.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component.
tooltipFormatter
Name of the user-defined function to format the tooltip.
type
Functions same as the type property of the HTML5. Not needs to be separately defined. Used to create UIs reflecting the data types of the HTML5.
useMonthYearFormat
[default:false] Same as when bound with the InputCalendar in which the dataType is "date" and the useMonthYearFormat is true.
userData1
User-defined property
userData2
User-defined property
userData3
User-defined property
useVerticalAlign
Aligns vertically in IE using the verticalAlign script.
validateOnCheckMaxByteLength
[default:false] Validates characters allowed by ignoreChar and allowChar property settings as long as specified by maxByteLength.
validateOnInput
[default:false] Whether to validate the input of the Input component upon the oninput event being triggered. (Supported in IE9 and higher versions which support the oninput event.)
validator
Runs the specified function upon blurring of the component.

Event Summary

onblur
Triggered upon being unfocused.
onchange
Triggered upon being unfocused.
onclick
Triggered upon the end user's clicking the component.
ondblclick
Triggered upon the end user's double-clicking the component.
oneditkeyup
Triggered upon the end user's releasing a key on the keyboard after pressing the key.
onfocus
Triggered upon being focused.
oninputinvalid
Fired upon a validation failure.
onkeydown
Triggered upon the end user's pressing a key on the keyboard.
onkeypress
Triggered upon the end user's pressing a key (and maintaining the key being pressed) on the keyboard.
onkeyup
Triggered upon the end user's releasing a key on the keyboard after pressing the key.
onmousedown
Triggered upon the end user's clicking the mouse.
onmousemove
Triggered upon moving of the mouse pointer.
onmouseout
Triggered upon the mouse focus moving out of a specified area or link.
onmouseover
Triggered upon the mouse moving into a specified area or link.
onmouseup
Triggered upon the end user's unclicking the mouse (after clicking).
ontooltiphide
Triggered upon the tooltip being hidden
ontooltipshow
Triggered upon the tooltip showing
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.
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.)
commit( )
Reflects the displayed value to the ref when the Input is bound with the ref.
focus( )
Focuses the WebSquare component.
focusNextTabOrder( )
Moves the focus to the nextTabID component when the nextTabID is specified.
focusPreTabOrder( )
If the current component is set as the nextTabID, moves the focus to the component that originally set the nextTabID.
getDataListInfo( )
Returns the dataList bound with the component.
getDataType( )
[default:text] Returns the current value of the dataType.
getDisabled( )
Returns the current value of the disabled property.
getDisplayFormat( )
Returns the current value of the displayFormat property.
getDisplayFormatter( )
Returns the current function set for the displayFormatter property.
getDisplayValue( )
Returns the currently displayed (formatted) value.
getFormattedValue( )
Returns the formatted input value.
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.
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.
getReadOnly( )
Returns the current value of the readOnly property.
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.)
getSize( sizeName )
Sets the size (width, height) of the WebSquare component.
getStyle( propertyName )
Returns the CSS setting of the WebSquare component.
getStyleValue( style )
[deprecated]
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( )
Returns the current value of the component.
hasClass( className )
Checks whether the WebSquare component has a certain class.
hide( )
Hides the WebSquare component. (Supported in all WebSquare components.)
removeClass( className )
Removes a class from the WebSquare component. (Supported in all WebSquare components.)
setAllowChar( allowChar )
Changes the allowChar.
setDefaultValue( initValue )
Sets the initValue property of the component.
setDisabled( disabled )
Sets the disabled property.
setDisplayFormat( format )
Sets the displayFormat property of the component.
setDisplayFormatter( formatter )
Sets the displayFormatter property of the component.
setEventPause( evList , flag )
Pauses the event.
setInitStyle( property )
Restores the initial style of the WebSquare component.
setIoFormat( ioFormat , displayFormat )
Sets the ioFormat of the input.
setMaxByteLength( maxByteLength )
Dynamically sets the maxByteLength.
setMaxLength( maxLength )
Dynamically sets the maxLength.
setNextTabID( componentID , componentScope )
Sets the nextTabID property.
setOpacity( value )
Sets the opacity in the WebSquare component. (Supported in all WebSquare components.)
setPlaceholder( placeholderStr )
Changes the placeholder property.
setPosition( left , top , mode )
Sets the position (left, top) of the WebSquare component.
setReadOnly( readOnly )
Controls the "readOnly" property.
setRef( title )
Sets the ref property. Add “data:” prefix to bind with a DataCollection.
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 )
Sets the value of the component.
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

adjustMaxLength
Adjusts the maxLength if the dataType is number and the data starts with - or +.
allowChar
Characters to allow. Implemented by RegExp of JavaScript. Korean/Chinese characters are applied upon blurring.
applyFormat
The application range of the formatted value. In case of all, the value and the displayed value will be the same and the displayed value will be formatted during the input.
For the displayed data, the format will be applied after the input is completed. In case of dataType = "text", only applyFormat = "display" is supported.
autoFocus
When the maxByteLength is reached with the nextTabID being defined, automatically moves the focus.
However, in case the last-inputted character is a Korean character, the focus will not be automatically moved. (This is because even an unfinished Korean character reaches the maxByteLength.)
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.
customModelFormatter
[default: ""] User-defined function executed before the data is saved in the dataCollection bound with the component.
Executes the user-defined function, and saves the returned value in the dataCollection.
customModelUnformatter
[default: ""] User-defined function to be executed upon the data being read from the dataCollection bound with the component.
For example, executing the getCellDisplayData API will return the result of the user-defined function.
dataType
[default:text, number, float, date, time, bigDecimal,euro] Data type of the component value. Referred to by other properties such as displayFormat.
disabled
[default:false, true] Disable the component. (Options) "false" (Default) Not disable the component. "true" Disable the component.
displayFormat
Formats the values same as in Excel file. Depends on the dataType defined in the Engine.
Cannot be used with the displayFormatter.
(Example) When the dataType is number#,###.#0 means that the comma will be added to every three digits and be of up to two decimal points.
displayFormatter
Name of the function that format the component value.
Formats the value from the Engine, and returns the final value to be displayed.
(Example) Define function fn_inputFormat (tmpVal){ return tmpVal+" 님" }; in the global script. Set the property as displayFormatter="fn_inputFormat".
displaymessage
[default: false, true] Displays the result upon a validation failure.
Displays the result message upon a validation failure by the validation API. Define a customized message using the invalidMessageFunc property.
editType
[default:focus, select] Defines the action to be triggered upon the end user’s clicking the component. (Options) "select" (Default) Selects the focused text. "focus" Move the cursor to the end of the text.
enterBlur
[default:true, false] Blurs and generates the blur event upon the end user's pressing the Enter key.
escape
[true, false] Converts <>&" into HTML Escape characters. (Options) "false" (Default) Converts into HTML Escape characters. "true" Not convert into HTML Escape characters.
euroMask
[default: ""] Masking value to be applied when the dataType is "euro" or when the changeCurrency API is used.
fireEventOnInvalid
[default:false] Fires the event upon a validation failure.
id
Component ID
The component ID is allocated as a global object. The script can access each object through the component ID.
ignoreChar
Characters to ignore. Implemented in RegExp of JavaScript. Specified Korean/Chinese characters will be ignored upon blurring.
imeMode
Sets the ime-mode (CSS). (Functions only in the browsers including ID that support the ime-mode.)
initValue
Initial value set for the Input component
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
ioFormat
[defulat:yyyyMMdd] Converts the data inputted by the end user according to the specified format.
If the dateType is date and the displayFormat is MM.dd.yyyy, define this property is MMddyyy (without a delimiter).
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();
maskFormat
[default: ""] Provides a similar feature to that of jQuery Mask plug-in. Changes numeric characters instead of #.
default: Applies the masking format defined in the displayFormat format from the left.
reverse: Applies the masking format defined in the displayFormat from the right.
Example of the displayFormat) ###-###-####, ##-###
The applyFormat property functions same.
Valid only when the dataType is text or number. When the dataType is number, use of “0” in the masking format is supported. (“#” is not displayed during the user’s input, but “0” is displayed during the user’s input.)
Related Properties: displayFormat, applyFormat, dataType (These properties must be defined.)
maskFormatModelExcludeChar
Specifies the characters to exclude from the bound DataCollection when using the maskFormat.
The maskFormatModelExcludeChar contained in the data will not be saved in the DataCollection.
maxByteLength
Maximum input length in bytes. The exceeding characters will be automatically cut.
The value of the maxLength or the value of this property whichever is smaller will be applied.
If the byteCheckEncoding is euc-kr in config.xml, one Korean character will be counted as two bytes. In case of utf-8, it will be counted as three bytes.
maxlength
Maximum input length. Exceeding characters will be automatically cut.
The value of the maxByteLength or the value of this property whichever is smaller will be applied.
minByteLength
Checks the minimum byte length upon calling of the validation API.
If the byteCheckEncoding is euc-kr in config.xml, one Korean character will be counted as two bytes. In case of utf-8, it will be counted as three bytes.
minlength
Checks the minimum length upon calling of the validation API.
nextTabByEnter
Allows the Enter key to function same as the Tab key when the nextTabID is given. Upon the end user’s pressing the Enter key, the focus will move to the nextTabID component.
Added only to the InputBox.
nextTabID
The ID of the component to be selected upon the end user’s pressing the Tab key.
numberMask
[default: ""] Masking value to be applied when the dataType is "number" or when the changeCurrency API is used.
onFocusClass
Name of the class to apply upon onFocus
placeholder
Hint for the end users. Functions same as the placeholder of HTML5.
The operation method depends on the browser. (For examples, in case of IE, the hint will disappear upon being focused. However, on Chrome, the hint disappears upon Text input.)
preventCopyPaste
[default:false, true] Prevents component values from being copied-and-pasted.
readOnly
[default:false, true] Setting of the readOnly property. Functions same as the readOnly of the HTML.
readOnlyClass
Name of the class to apply for readOnly mode.
readOnlyFocusEvent
[default:false, true] Generates focus event when the input object is readOnly.
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.name
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/name/@value
refSync
[default:false, true] Refreshes the ref as soon as the key of the ref bound with the input is entered.
When the Input is bound with a DataMap through the ref property, executing dataMap1.get("key1") in the onkeydown event will return the inputted value.
Restriction) Real-time return is not supported. Instead, the end user must use Enter or Tab, and commit() API must be called. (ex) input1.commit()
(Version: Added in 5.0_2.2777B.20170904.121217.)
rupeeMask
[default: ""] Masking value to be applied when the dataType is "rupee" or when the changeCurrency API is used.

/**
showPlaceHolderOnReadOnly
Displays the placeholder in the readOnly mode (readOnly="true").
true: Display.
false (Default): Not display.
Related properties: readOnly, placeholder
tabIndex
The focusing order by the Tab key.
Same as the tabindex property in HTML.
tengeMask
[default: ""] Masking value to be applied when the dataType is "tenge" or when the changeCurrency API is used.
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.
tooltipFormatter
Name of the user-defined function to format the tooltip. (The user must separately write the script to implement the function.)
type
Functions same as the type property of the HTML5. Not needs to be separately defined. Used to create UIs reflecting the data types of the HTML5.
For example, if the type is number, the developer may load the number key pad on the mobile browser.
For the color type, the developer may allow users to select a color without using the colorPicker. This feature, however, is supported only in HTML5-compliant browsers.
useMonthYearFormat
[default:false] Same as when bound with the InputCalendar in which the dataType is "date" and the useMonthYearFormat is true.
The same features is provided.
useMonthYearFormat of the InputCalendar: Changes the date order from year/month to month/year.
When bound with the dataCollection, the date will be saved in order of "Year" > "Month" > "Day".
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");
useVerticalAlign
Aligns vertically in IE using the verticalAlign script. This option is to support lower compatibility.
validateOnCheckMaxByteLength
[default:false] Validates characters allowed by ignoreChar and allowChar property settings as long as specified by maxByteLength.
true: Validates only the characters allowed by ignoreChar and allowChar properties.
false (Default): Validates all characters.
(Useful when copying only allowed characters within the allowed length.)
Related Properties: ignoreChar, allowChar, maxByteLength
validateOnInput
[default:false] Whether to validate the input of the Input component upon the oninput event being triggered. (Supported in IE9 and higher versions which support the oninput event.)
true: Validates input (including Korean characters) upon the oninput event being trigger.
false (Default): Does not validate input.
validator
Runs the specified function upon blurring of the component.
The specified function is executed before the onblur event, and validates upon occurrence of blurring. The developer can change the value through the return.

Event Detail

onblur
Triggered when the focus is lost.
Parameter
nametypedescription
eObjectEvent object
onchange
Triggered upon being unfocused.
A change made by the script will also trigger a change. Use the onviewchage event to compare old and new values.
onclick
Triggered upon the end user's clicking the component.
Parameter
nametypedescription
eObjectEvent object
ondblclick
Triggered upon the end user's double-clicking the component.
Parameter
nametypedescription
eObjectEvent object
oneditkeyup
Triggered upon the end user's releasing a key on the keyboard after pressing the key. A JSON object containing oldValue, newValue, and keyCode is received.
Parameter
nametypedescription
infoJSONReturns a JSON containing oldValue, newValue, and keyCode. <String> info.oldValue : Old input value before the key input <String> info.newValue : Input after key input. <Number> info.keyCode : Entered key code
Sample
<xf:input id="input1" ev:oneditkeyup="scwin.input1_oneditkeyup"/> scwin.input1_oneditkeyup = function(info) { var logStr = "oldValue=" + info.oldValue + ", newValue=" + info.newValue + ", keyCode=" + info.keyCode; WebSquare.logger.printLog(logStr); console.log(logStr); }
onfocus
Triggered upon the component being focused.
Parameter
nametypedescription
eObjectEvent object
oninputinvalid
Fired upon a validation failure.
Parameter
nametypedescription
infoJSONReturns JSON data containing callerId, detail, type, and value. <String> info.callerId : ID of the Input component subject to validation <String> info.type : Name of the validator ( maxlength, float, maxbytesize, etc.) <String> info.value : validation-failed value <String> info.detail : validation failure details
onkeydown
Triggered upon the end user's pressing a key on the keyboard.
Parameter
nametypedescription
eObjectEvent object
onkeypress
Triggered upon the end user's pressing a key (and maintaining the key being pressed) on the keyboard.
Parameter
nametypedescription
eObjectEvent object
onkeyup
Triggered upon the end user's releasing a key on the keyboard after pressing the key.
Parameter
nametypedescription
eObjectEvent object
onmousedown
Triggered upon the end user's clicking the mouse.
Parameter
nametypedescription
eObjectEvent object
onmousemove
Triggered upon moving of the mouse pointer.
Parameter
nametypedescription
eObjectEvent object
onmouseout
Triggered upon the mouse focus moving out of a specified area or link.
Parameter
nametypedescription
eObjectEvent object
onmouseover
Triggered upon the mouse moving into a specified area or link.
Parameter
nametypedescription
eObjectEvent object
onmouseup
Triggered upon the end user's unclicking the mouse (after clicking).
Parameter
nametypedescription
eObjectEvent object
ontooltiphide
Triggered upon the tooltip being hidden
ontooltipshow
Triggered upon the tooltip showing
onviewchange
Triggered when the value on the list is changed through keyboard input or mouse clicking.
Parameter
nametypedescription
infoJSONReturns JSON data containing oldValue and newValue. <String> info.oldValue : Old value <String> info.newValue : New value
Sample
// The event is within the component tag. <script ev:event="onviewchange( info )"><![CDATA[ var oldValue = info.oldValue; var newValue = info.newValue; ]]></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");
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");
commit( )
Reflects the displayed value to the ref when the Input is bound with the ref.
Not every keys are applied in real time. The end user must use the Enter or Tab.
Sample
scwin.input1_onkeydown = function(e) { if((e.charCode || e.keyCode) === 13) { input1.commit(); // Apply the currently entered value to dataMap1.key1. If omitted, the previously entered value will be returned for key1. dataMap1.get("key1"); } }
focus( )
Focuses the WebSquare component. (Supported in all WebSquare components.)
focusNextTabOrder( )
Moves the focus to the nextTabID component when the nextTabID is specified.
Sample
input1.focusNextTabOrder();
focusPreTabOrder( )
If the current component is set as the nextTabID, moves the focus to the component that originally set the nextTabID.
Sample
input1.focusPreTabOrder();
getDataListInfo( )
Returns the dataList bound with the component.
Return
typedescription
ObjectReturns nodeset, label, and value id as an object.
Sample
// Example input1.getDataListInfo();
getDataType( )
[default:text] Returns the current value of the dataType.
Return
typedescription
StringdataType of the input
Sample
// The input is defined as shown below. <xf:input id="input1" dataType="number" style="position: relative;width: 140px;height: 21px;"></xf:input> var returnValue = input1.getDataType(); // (Return) "number"
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
getDisplayFormat( )
Returns the current value of the displayFormat property.
Return
typedescription
StringCurrent displayFormat
Sample
// The dataType is number and the displayFormat is #,###. var returnValue = input1.getDisplayFormat(); // (Return) "#,###" // The dataType is date, the dateMask is yyyy-MM, and the ioFormat is yyyyMM. var returnValue = input1.getDisplayFormat(); // (Return) "yyyy-MM"
getDisplayFormatter( )
Returns the current function set for the displayFormatter property.
Return
typedescription
StringFunction for the displayFormatter
Sample
// set displayFormatter="eduObj.fn_numFormat" for the component. var returnValue = input1.getDisplayFormatter(); (Return) "eduObj.fn_numFormat"
getDisplayValue( )
Returns the currently displayed (formatted) value.
Return
typedescription
StringFormatted value
Sample
// Enter 1000000 when the dataType of the component input1 is number and the displayFormat #,###. var returnValue = input1.getDisplayValue(); // (Return)"1,000,000"
getFormattedValue( )
Returns the formatted input value.
Return
typedescription
StringFormatted input value
Sample
// Enter 1000000 when the dataType of the component input1 is number and the displayFormat #,###. var returnValue = input1.getFormattedValue(); // (Return)"1,000,000"
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.)
getNextTabID( )
Returns the nextTabID value. (Related Property) nextTabID
Sample
// Example var nextTabID = input1.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
getReadOnly( )
Returns the current value of the readOnly property. (Supported in all WebSquare components.)
Return
typedescription
BooleanThe current setting of the readOnly property
Sample
// Example to check the readOnly setting of the component. var returnValue = componentId.getReadOnly(); // (Return Example) false
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
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.)
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( )
Returns the current value of the component.
Return
typedescription
StringValue of the component
Sample
// Upon the end user's entering "WebSquare" in the component input1: input1.getValue(); // (Return) "WebSquare"
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();
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");
setAllowChar( allowChar )
Changes the allowChar.
Parameter
nametyperequireddescription
allowCharStringYallowChar value to set
Sample
input1.setAllowChart("5-9");
setDefaultValue( initValue )
Sets the initValue property of the component.
In most cases, sets the default value of the component upon the use of init API by a higher-level Group component. If not set, an empty string will be used as the initial value of the component.
Parameter
nametyperequireddescription
initValueStringYinitValue to set
Sample
// Define Group and InputBox components. <xf:group id="group1" style="position:relative;"> <xf:input id="input1" style="position: relative;width: 144px;height: 21px;"></xf:input> </xf:group> // Set the initial value of the InputBox component. input1.setDefaultValue("WebSquare"); // Call init API of the Group component. group1.init(); // Then, the value of the component input1 will be set as "WebSquare" instead of " ".
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);
setDisplayFormat( format )
Sets the displayFormat property of the component.
Parameter
nametyperequireddescription
formatStringYdisplayFormat to set
Sample
// Define an Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" dataType="number"></xf:input> // Change the format in a way to display comma (",") every three digits and to display up to two decimal values. input1.setDisplayFormat("#,###.#0"); // For example, the value "1000000" will be displayed as "1,000,000.00".
setDisplayFormatter( formatter )
Sets the displayFormatter property of the component.
Parameter
nametyperequireddescription
formatterStringYFunction for the new format
Sample
// The input is defined as shown below. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;"></xf:input> // Define the format function for the component in the global script as shown below. (The value will be displayed in upper cases.) var commObj = {}; commObj.fn_setUpper = function(value){ value = value.toUpperCase(); return value; }; // Set the displayFormatter for input1 component. input1.setDisplayFormatter("commObj.fn_setUpper"); // (Display) The inpuuted value "hong gil dong" will be displayed as "HONG GIL DONG".
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();
setIoFormat( ioFormat , displayFormat )
Sets the ioFormat of the input. Valid when the dataType is date.
Parameter
nametyperequireddescription
ioFormatStringYioFormat to set
displayFormatStringNNew displayFormat (dateMask)
Sample
// Define an Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" dataType="date" ioFormat="yyyyMMdd"></xf:input> input1.setIoFormat("ddMMyyyy", "dd/mm/yyyy"); // Newly set ioFormat and displayFormat. // Changing the ioFormat in the input for which values have been already set, the values will be automatically changed according to the new ioFormat. A value change will trigger the onchange event.
setMaxByteLength( maxByteLength )
Dynamically sets the maxByteLength.
Parameter
nametyperequireddescription
maxByteLengthNumberYmaxByteLength value to set
Sample
input1.setMaxByteLength(7);
setMaxLength( maxLength )
Sets the maxLength.
Parameter
nametyperequireddescription
maxLengthNumberYmaxLength to set
Sample
// Example input1.setMaxLength(7); // Set the maxLength as "7". input1.setMaxLength(""); // Removes maxLength restriction.
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 input1.setNextTabID("input2", "wframe1");
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);
setPlaceholder( placeholderStr )
Changes the placeholder property.
Parameter
nametyperequireddescription
placeholderStrStringYNew placeholder value
Sample
input1.setPlaceholder("Enter your name.");
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);
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( 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 the name key of dataMap1 with the component value. input1.setRef("data:dataMap1.name"); //Interface with res/userData/name of InstanceData. input1.setRef("res/userData/name");
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 )
Sets the value of the component.
Parameter
nametyperequireddescription
valueStringYinput value
Sample
input1.setValue("WebSquare");
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.
Related Properties : mandatory, minLength, maxLength, minByteLength, maxByteLength
Return
typedescription
BooleanValidation result
Sample
// Set the mandatory property in the component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" mandatory="true"></xf:input> var returnValue = input1.validate(); // (Return Example) - When there is no input, "false" will be returned. // (Return Example) - When there is an input, "true" 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.
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 the mandatory property in the component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" mandatory="true"></xf:input> var returnObj = input1.validateObject(); // Return Example - When there is no Input value, returnObj will be returned. returnObj.callerId = "input1" returnObj.type = "mandatory" returnObj.value = "" // Return Example - When there is an Input 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;