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

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

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.
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] Specifies the data type of the component value. Referred to by other properties such as displayFormat.
disabled
[default:false, true] Functions same as the disabled property of HTML. Disables 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 defines the customized format for the value.
displaymessage
[default: false, true] Displays the result upon a validation failure.
editType
[default:focus, select] Specifies the editing type when the component is focused in. In case of select, the entire string will be selected (or dragged).
enterBlur
[default:true, false] Blurs and generates the blur event upon the end user's pressing the Enter key.
euroMask
[default: ""] Masking value to be applied when the dataType is "euro" or when the changeCurrency API is used.
id
ID of the component. Allocated as a global object. Scripts access the component through the 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] Whether to check the mandatory input or not when calling the validation API.
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.
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.
ref
The value of the DataCollection. Required to bind the component with a DataCollection. Starts with a prefix of "data:".
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
Same as the tabindex property in HTML standard. Indicates the focusing order of the component 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 title property of HTML. Displays the Text upon the end user's hovering the mouse over the browser.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component.
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.
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.
onfocus
Triggered upon being focused.
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).
onviewchange
Triggered upon focusing out of the component after the end user's changing the input value (before onblurring of the component).

Method Summary

addClass( className )
Adds a class to the component.
bind( eventType , function )
Dynamically allocates events to the component.
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
focus( )
Moves the focus to the component.
getDataType( )
[default:text] Returns the current value of the dataType.
getDisabled( )
Gets 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( )
Called by a component under the Generator component. When called, gets the parent Generator object.
getID( )
Gets the ID of the component.
getOpacity( )
Gets the opacity of the component defined in CSS.
getPluginName( )
Gets the pluginName (or the name) of the component.
getPosition( positionName )
Gets the left or top position of the component.
getReadOnly( )
Gets the current setting of the readOnly property.
getSize( sizeName )
Gets the size of the component.
getStyle( propertyName )
Gets the current value of the propertyName of the component defined in CSS.
getStyleValue( style )
[deprecated] Use getStyle instead.
getTitle( )
Gets the title value.
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
getValue( )
Returns the current value of the component.
hasClass( className )
Checks whether the component has className received as a parameter or not.
hide( )
Hides the component.
removeClass( className )
Removes className from the component.
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 )
Disables or enables the component event.
setOpacity( value )
Sets the opacity of the component.
setPlaceholder( placeholderStr )
Changes the placeholder property.
setPosition( left , top , mode )
Sets the position (left, top) of the component.
setReadOnly( readOnly )
Controls the "readOnly" property.
setRef( ref )
Dynamically sets the ref binding. Add data: prefix to bind with a DataCollection.
setSize( width , heigth )
Sets the size (width, height) of the component.
setStyle( propertyName , value )
Sets the style of the specified property.
setUserData( key , value )
Sets the user data in the component.
setValue( value )
Sets the value of the component.
show( displayType )
Displays the component.
toggleClass( className )
Removes a class named className, or if there is no such a class, adds a class named className.
trigger( type , array )
Triggers a certain event registered for the component.
unbind( type , function )
Removes an event registered for the component.
unbindRef( )
Releases the ref binding.
validate( )
Validates the component according to the specified properties.
validateObject( )
Validates the component according to the specified properties.
visible( flag )
[deprecated] Shows/Hides the component, or sets the visible property using setStyle.

Property Detail

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 foramt will be applied after the input is completed.
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] Specifies the data type of the component value. Referred to by other properties such as displayFormat.
float is supported from 5.0_1.2705B.20170721.164120.
disabled
[default:false, true] Functions same as the disabled property of HTML. Disables the component.
The developer can control the style for the disabled status through the use of a CSS class called .w2input_disabled.
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 defines the customized format for the value.
Formats the value, and returns the formatted value.
(Example) Define a function fn_inputFormat (tmpVal){ return tmpVal+" 님" }; in the global script, and define the displayFormatter as 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] Specifies the editing type when the component is focused in. In case of select, the entire string will be selected (or dragged).
enterBlur
[default:true, false] Blurs and generates the blur event upon the end user's pressing the Enter key.
euroMask
[default: ""] Masking value to be applied when the dataType is "euro" or when the changeCurrency API is used.
id
ID of the component. Allocated as a global object. Scripts access the component through the 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] Whether to check the mandatory input or not when calling the validation API.
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.
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.
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
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
Same as the tabindex property in HTML standard. Indicates the focusing order of the component 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 title property of HTML. Displays the Text upon the end user's hovering the mouse over the browser. Generally used to support web accessibility.
toolTip
Tooltip provided by WebSquare5. Displays additional information of the component. Displayed upon mouse-over.다.
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("userData1") to get the data.
userData2
User-defined property. Use getUserData("userData2") to get the data.
userData3
User-defined property. Use getUserData("userData3") to get the data.
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
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
onfocus
Triggered upon the component being focused.
Parameter
nametypedescription
eObjectEvent object
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
onviewchange
Triggered upon focusing out of the component after the end user's changing the input value (before onblurring of the component).
In case the change was made by a script, the event will not be triggered. (Similar to the native onchange event.)
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 class to the component.
Parameter
nametyperequireddescription
classNameStringYName of the class to add
Sample
// Add oddClass to component input1. input1.addClass("oddClass");
bind( eventType , function )
Dynamically allocates events to the component.
Parameter
nametyperequireddescription
eventTypeStringYName of the event to allocate.
functionFunctionYHandler function of the event to allocate.
Sample
// Define the event handler function for the onclick event in the input component, and bind the function. input1.bind("onclick", function(e){ alert(input1.getValue();})); // Bind commObj.ev_click function for the onclick event with component input1. var commObj = {}; commObj.ev_click = function(e){ alert("click :: "+this.id); }; input1.bind("onclick", commObj.ev_click );
changeClass( oldClassName , newClassName )
Renames the class from oldClassName to newClassName.
In the default setting, only the classes added by addClass will be applied. In order to directly remove the class defined in the "class" property of the component, add the following setting in config.xml file.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
oldClassNameStringYName of the class to remove
newClassNameStringYName of the class to add
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Change tmpInputClass class to tmpInputWarninClass. input1.changeClass("tmpInputClass","tmpInputWarninClass");
focus( )
Moves the focus to the component.
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( )
Gets the current value of the disabled property.
Return
typedescription
BooleanThe value of the disabled property.
Sample
var returnValue = componentId.getDisabled(); (Return example) 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( )
Called by a component under the Generator component. When called, gets the parent Generator object.
Return
typedescription
ObjectParent Generator object
Sample
<w2:generator id="generator1"> <w2:trigger id="trigger1" ev:onclick="scwin.trigger1_onclick"></w2:trigger></w2:generator> scwin.trigger1.onclick = function(){ console.log(this.getGenerator());} // Click trigger1 to display the generator1 object on the console. // See https://inswave.com/jira/browse/WPF-1425.
getID( )
Gets the ID of the component.
Return
typedescription
StringID of the WebSquare5 component
Sample
// The WebSquare5 component dynamically received as a parameter can be used as shown in the following. function fn_validCheck(tmpObj){ // tmpObj has an ID of "input1". var compID = tmpObj.getID(); // (Return Example) "input1" }
getOpacity( )
Gets the opacity of the component defined in CSS.
Return
typedescription
IntegerOpacity
Sample
// Apply opacity CSS to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;opacity:0.2;"></xf:input> var returnValue = input1.getOpacity(); // "returnValue" is a real number between 0 and 1. // (Return Value) "0.2"
getPluginName( )
Gets the pluginName (or the name) of the component.
Return
typedescription
StringpluginName of the WebSquare5 component
Sample
// For a WebSquare5 object dynamically received by a common function, conditional statements can be used as shown below. var commObj = {}; commObj.fn_makeReqData = function(tmpObj){ var tmpID = tmpObj.getID(); // Component ID var tmpCompType = tmpObj.getPluginName(); // Component Type if(tmpCompType == "input"){ //..Logic.. }else if(tmpCompType == "gridView"){ //..Logic .. }else{ //..Logic.. } };
getPosition( positionName )
Gets the left or top position of the component. If set by %, the corresponding pixel value will be returned.
Parameter
nametyperequireddescription
positionNameStringY[left,top] Type of the position
Return
typedescription
NumberPosition of the component
Sample
// Apply margin CSS to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;margin:10px;"></xf:input> var returnValue = input1.getPosition("top"); // The returnValue will be a position in pixels. // (Return Example) 10
getReadOnly( )
Gets the current setting of the readOnly property.
Return
typedescription
BooleanThe current setting of the readOnly property
Sample
var returnValue = componentId.getReadOnly(); // (Return Example) false
getSize( sizeName )
Gets the size of the component. If set by "%", the corresponding pixel value will be returned.
Parameter
nametyperequireddescription
sizeNameStringY[height, innerHeight, outerHeight, outerMarginHeight, width, innerWidth, outerWidth, outerMarginWidth] Type of the size. For the calculation of each size type, see below.
height : element.clientHeight innerHeight : element.clientHeight + padding outerHeight : element.clientHeight + padding + border outerMarginHeight : element.clientHeight + padding + border + margin width : element.clientWidth innerWidth : element.clientWidth + padding outerWidth : element.clientWidth + padding + border outerMarginWidth : element.clientWidth + padding + border + margin
Return
typedescription
NumberSize of the component
Sample
var returnValue = componentId.getSize("width"); // "returnValue" will be a size in pixels. If set by "%", the corresponding pixel value will be returned. // (Return Example) 100
getStyle( propertyName )
Gets the current value of the propertyName of the component defined in CSS.
Parameter
nametyperequireddescription
propertyNameStringYName of the property in the style
Return
typedescription
StringStyle value
Sample
// Define an Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;"></xf:input> var returnValue = input1.getStyle("width"); // (Return Example) "144px"
getStyleValue( style )
[deprecated] Use getStyle instead.
Gets the current value of the propertyName of the component defined in CSS.
Parameter
nametyperequireddescription
styleStringYName of the property defined in the style
Return
typedescription
StringValue defined in the style property. (In case of a color, the hexcode of the color will be returned.)
getTitle( )
Gets the title value.
Return
typedescription
StringTitle value
Sample
// Define the "title" for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" title="이름 입력"></xf:input> var tmpTitle = input1.getTitle(); // (Return Example ) "Input Name"
getUserData( key )
Returns the user-defined property value set by setUserData as the user data or source (page XML).
Parameter
nametyperequireddescription
keyStringYRandom data key
Return
typedescription
StringData of the corresponding key
Sample
// Apply the customized property (eduTest) to the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" eduTest="Hello"></xf:input> input1.getUserData("eduTest"); // (Return Example) "Hello" // Use setUserData. input1.setUserData("eduTest","WebSquare"); input1.getUserData("WebSquare"); // (Return Example) "Hello"
getValue( )
Returns the 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 component has className received as a parameter or not.
Parameter
nametyperequireddescription
classNameStringYclassName to check
Return
typedescription
BooleanWhether the component has the class or not
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> var returnValue = input1.hasClass("tmpInputClass"); // (Return Example) true
hide( )
Hides the component.
he CSS setting will be "display:none;" and "visibility:hidden;".
Sample
componentId.hide();
removeClass( className )
Removes className from the component.
In the default setting, only the classes added by addClass will be applied. In order to directly remove the class defined in the "class" property of the component, add the following setting in config.xml file.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYName of the class to remove
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.removeClass("tmpInputClass");
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 )
Disables or enables the component event.
Parameter
nametyperequireddescription
evListStringNList of the events. If not specified, all user events of the component will be listed. (Enter null data.)
flagBooleanYtrue is to pause, or false is to cancel pausing.
Sample
input1.setEventPause("onclick", true); // Dynamically pauses the onclick event. input1.setEventPause("onfocus,onblur", false); // Restarts the onfocus and the onblur events. input1.setEventPause(null, true); // Pauses all user events registered for the Input component.
setOpacity( value )
Sets the opacity of the component.
Parameter
nametyperequireddescription
valueNumberYOpacity value (A real number between 0 and 1)
Sample
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 component.
Parameter
nametyperequireddescription
leftNumberYLeft position or null.
topNumberYTop position or null.
modeStringN[defulat:absolute, delta] absolute sets the current positions as x and y, and delta adds x and y to the current positions.
Sample
// Set the top position of the component as 100 pixels. componentId.setPosition(null, 100);
setReadOnly( readOnly )
Controls the "readOnly" property. True to enable, or false to disable.
Parameter
nametyperequireddescription
readOnlyBooleanYTrue to enable, or false to disable.
Sample
// Enable the read-only. componentId.setReadOnly(true);
setRef( ref )
Dynamically sets the ref binding. Add data: prefix to bind with a DataCollection.
If not specified, XPath of the InstanceData will be used.
Parameter
nametyperequireddescription
refStringYPath of the 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 , heigth )
Sets the size (width, height) of the component.
Parameter
nametyperequireddescription
widthNumberYComponent width or null
heigthNumberYComponent height or null
Sample
// Set the component height as 100 pixels. componentId.setSize(null,100);
setStyle( propertyName , value )
Sets the style of the specified property.
Parameter
nametyperequireddescription
propertyNameStringYName of the style
valueStringYValue of the style
Sample
// Set the component width as 200px. componentId.setStyle("width", "200px"); // Change the background color to olive. componentId.setStyle("background-color","olive");
setUserData( key , value )
Sets the user data in the component. If the key cannot be set for the component, corresponding logs will be displayed.
Parameter
nametyperequireddescription
keyStringYRandom data key
valueStringYRandom data key
Sample
// Setting a (key, value) pair of ("data", "WebSquare5") in the component. componentId.setUserData("data", "WebSquare"); // Some keys cannot be set for the component. componentId.setUserData("title", "WebSquare"); // (Log Example) !!!WARNING - [title] can't define as UserData
setValue( value )
Sets the value of the component.
Parameter
nametyperequireddescription
valueStringYinput value
Sample
input1.setValue("WebSquare");
show( displayType )
Displays the component.
The related CSS properties are display and visibility:show;.
Parameter
nametyperequireddescription
displayTypeStringN[default:block ,inline ,none ,""] Value of the Display property.
Sample
// Block the "display" property. componentId.show(); // Enable the "display" property in the class. componentId.show("");
toggleClass( className )
Removes a class named className, or if there is no such a class, adds a class named className.
In the default setting, only the classes added by addClass can be removed. To remove other classes, add the following setting in config.xml.
<style><removeDefaultClass value="true" /></style>
Parameter
nametyperequireddescription
classNameStringYclassName to set
Sample
// Define a class for the Input component. <xf:input id="input1" style="position: relative;width: 144px;height: 21px;" class="tmpInputClass"></xf:input> // Add the following to config.xml. <style> <removeDefaultClass value="true" /> </style> // Remove tmpInputClass class. input1.toggleClass("tmpInputClass"); // Add tmpInputClass class again. input1.toggleClass("tmpInputClass");
trigger( type , array )
Triggers a certain event registered for the component.
Parameter
nametyperequireddescription
typeStringYName of the event to trigger
arrayArrayNArray of parameters to send to the event handler
Sample
// Trigger the onclick event in the input1 component. input1.trigger("onclick"); // Trigger the onviewchange event in the input component and call the event handler function by sending arguments of (1, 2). input1.trigger("onviewchange", [1,2]);
unbind( type , function )
Removes an event registered for the component.
Parameter
nametyperequireddescription
typeStringNName of the event to remove. If not specified, all events of the components will be removed.
functionFunctionNHandler function of the event to remove. If not specified, all handler functions of the event will be removed.
Sample
// Remove all events registered in the input component. input1.unbind(); // Remove all handler functions of onviewchange event registered in the input component. input1.unbind("onviewchange"); // Remove the func1 event handler of onviewchange event registered for component input1. input1.unbind("onviewchange", func1);
unbindRef( )
Releases the ref binding.
validate( )
Validates the component according to the specified properties.
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
(Version: Added in 5.0_1.2783B.20170908.145609.)
Return
typedescription
Objectobject validation result object
<String> object.callerId Validation target component ID <String> object.type Validation items <Boolean> object.value Validation result
Sample
// Set 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 - without Input value) An empty object is returned. // Return - with Input value) returnObj is returned. returnObj.callerId = "input1" returnObj.type = "mandatory" returnObj.value = "" 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] Shows/Hides the component, or sets the visible property using setStyle.
Sets the visibility of the component style. In case of true, set visible. In case of false, set hidden.
Parameter
nametyperequireddescription
flagBooleanYVisibility (In case of true, set visible. In case of false, set hidden.)