String

Automatic Conversion for Korean Input with English Keyword

Sometimes, Korean is entered in the English keyboard. In this case, you may not recognize the error and continue typing. If you find it late, you will have to enter it again. Many of these mistakes are appearing in the search window, so the search portal asks if the user has found this if they type in Korean using the English keyboard.

In this example, we will take a look at how the text entered in English can be changed to Korean.

The script used in the example refers to published script examples.

Source: http://www.theyt.net/

Example

When English is entered in the TextArea component marked English, Korean is displayed in the Korean item. Conversely, if you enter Korean in the Korean item, English is displayed in the English item.

sample_string_01.xfdl

Core features used in the example

oninput

This is the event that occurs when the string is entered into the TextArea component. In the example, there is no button to process separate commands, and when inputting into the TextArea component, the English is changed to Korean.

fromCharCode

This is the method that returns the Unicode value transmitted as the argument as the string.

How to implement an example

1

Configuring Form Screen

Display the text "English" and "Korean" as the Static component and place the TextArea component next to the text.

2

Writing TextArea Component Event Function

Process the event to be processed when entering the string into the TextArea component. Write the oninput event function as follows. There is no actual conversion within the oninput event function. Looking at the part of specifying the value to the TextArea component, functions called engTypeToKor and KorTypeToEng are being called again. You can see that the actual conversion is being processed by the corresponding function.

this.TextArea00_oninput = function(obj:nexacro.TextArea,e:nexacro.InputEventInfo)
{
	if(obj.value == null || obj.value== '') {
		this.TextArea01.set_value('');
	} else {
		this.TextArea01.set_value(this.engTypeToKor(obj.value));
	}
};

this.TextArea01_oninput = function(obj:nexacro.TextArea,e:nexacro.InputEventInfo)
{
	this.TextArea00.set_value(this.korTypeToEng(obj.value));
};

3

Setting Variable

In this example, it is important to find out what the user entered while setting the English and Korean incorrectly. Therefore, when you type in English, you just need to determine which character string will appear when you enter the keyboard in the Korean setting. For the value set as the variable, specify in advance what characters are output in Korean and English when the same keyboard is pressed.

this.ENG_KEY = "rRseEfaqQtTdwWczxvgkoiOjpuPhynbml";
this.KOR_KEY = "ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎㅏㅐㅑㅒㅓㅔㅕㅖㅗㅛㅜㅠㅡㅣ";
this.CHO_DATA = "ㄱㄲㄴㄷㄸㄹㅁㅂㅃㅅㅆㅇㅈㅉㅊㅋㅌㅍㅎ";
this.JUNG_DATA = "ㅏㅐㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜㅝㅞㅟㅠㅡㅢㅣ";
this.JONG_DATA = "ㄱㄲㄳㄴㄵㄶㄷㄹㄺㄻㄼㄽㄾㄿㅀㅁㅂㅄㅅㅆㅇㅈㅊㅋㅌㅍㅎ";

English can be listed as-is, but in the case of Korean, separate data is managed as the variable because the initial consonant, vowel, and final consonant must be combined.

4

Writing engTypeToKor Function

In order to change English to Korean, find and display Korean data that fits the entered English keyboard. First, check if the entered value is in the English keyboard variable set earlier. In the script below, if the value of p is -1, it is determined that it is not in the English keyboard variable, and in other cases, you can find the Korean keyboard value according to the value.

var ch = src.charAt(i);
var p = this.ENG_KEY.indexOf(ch);

It would be convenient if the English and Korean keyboards were connected in a 1:1 way, but because Korean has to combine the initial consonant, vowel, and final consonant, it goes through a more complicated process. Check whether the Korean corresponding to the input English is the initial consonant, vowel, and final consonant, and make it into one character again in the makeHangul function.

if (nJong == -1) {
	nJong = this.JONG_DATA.indexOf(this.KOR_KEY.charAt(p));
	if (nJong == -1) {
		res += this.makeHangul(nCho, nJung, nJong);
		nCho = this.CHO_DATA.indexOf(this.KOR_KEY.charAt(p));
		nJung = -1;
	}
}

Please refer to the source for the full script code.

5

Writing makeHangul Function

The fromCharCode method returns characters when you enter the Unicode value.

this.makeHangul = function (nCho, nJung, nJong) {
	return String.fromCharCode(0xac00 + nCho * 21 * 28 + nJung * 28 + nJong + 1);
};

6

Writing korTypeToEng Function

In the case of converting Korean to English, the initial consonant, vowel, and final consonant of the combined Korean must be disassembled. When Korean is combined, it is connected to 5 English keyboards in the case of "눩". To disassemble it, an array of 5 lengths is created and the character is disassembled.

for (var i = 0; i < src.length; i++) {
	var ch = src.charAt(i);
	var nCode = ch.charCodeAt(0);
	var nCho = this.CHO_DATA.indexOf(ch), nJung = this.JUNG_DATA.indexOf(ch), nJong = this.JONG_DATA.indexOf(ch);
	var arrKeyIndex = [-1, -1, -1, -1, -1];
		
	if (0xac00 <= nCode && nCode <= 0xd7a3) {
		nCode -= 0xac00;
		arrKeyIndex[0] = Math.floor(nCode / (21 * 28));
		arrKeyIndex[1] = Math.floor(nCode / 28) % 21;
		arrKeyIndex[3] = nCode % 28 - 1;

Please refer to the source for the full script code.

7

Checking with QuickView

Run it with QuickView (Ctrl + F6), try entering another language in the English and Korean items, and check the result.

Verifying Email Address Value

If there is an item where an email address value is entered, then check whether the entered value is a valid email address value.

Example

If you enter an email address value in the e-mail item and click the [check] button, then whether the input value is a valid value or not is displayed as true/false in the result item.

sample_string_02.xfdl

Core features used in the example

indexOf

Check if there are any characters that cannot be used in the email address in the entered character string. Returns -1 if there are unacceptable characters.

How to implement an example

1

Configuring Form Screen

Place the Static component, Edit component, and Button component.

2

Writing Button Component Click Event Function

Write the event function to be executed when the Button component is clicked. Verify the input value in the fn_checkEmail function and display the verified result in the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var sRtn = this.fn_checkEmail(this.Edit00.value);
	this.Edit01.set_value(sRtn);
};

3

Writing fn_checkEmail Function

Store all characters that can be used as email address values in the variable called vChk. Then, check the entered email address value using the indexOf method within the for statement.

this.fn_checkEmail = function(sValue)
{
	var vChk = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-._@";
	for (var i = 0 ; i<sValue.length ; i++) {
		if (vChk.indexOf(sValue.charAt(i)) < 0)  {
			trace(vChk.indexOf(sValue.charAt(i)));
			return false;
        }
	}
	return true;
}

In the case of writing as above, it is possible to only prevent the inclusion of invalid characters. If there is no "@" character in the middle or if the domain format is wrong, then it cannot be checked. The function needs to be supplemented for the rest of the verification process.

Please refer to the source for the full script code.

4

Checking with QuickView

Run it with QuickView (Ctrl + F6) and enter the invalid email address to check it.

Converting Full-width & Half-width Characters

This is not useful if you only use Korean or English, but it is a necessary function if you are creating an application that supports Japanese.

Example

Enter full-width or half-width characters and click the button to convert them to half-width or full-width characters.

sample_string_03.xfdl

Core features used in the example

charCodeAt

Returns the Unicode value for the character at a specific index location in the input string. The example checks the Unicode value and converts it to full-width or half-width characters by adding or subtracting values for conversion.

imemode

Able to specify the IME mode. This property value only supports IE browser and Nexacro browser. Full-width input is not supported when using the IE browser.

How to implement an example

1

Configuring Form Screen

Place the Static component, Edit component, and Button component. The Static component is used to display text in front of the Edit component.

2

Specifying Edit Component Property

Set the imemode property value of the Edit component to enter full-width characters as "alpha,full" and the imemode property value of the Edit component to enter half-width characters as "alpha". This property operates only when running with Nexacro browser.

In order to easily check the operation in the web browser, enter the full-width and half-width characters in advance as the value property value. In general Korean IME, full-width English characters can be entered as follows.

Set the enable property value of the Edit component that outputs the character to be converted to false.

3

Writing onclick Event Function of Button Component

To convert the input string, call the fn_fullToHalf and fn_halfToFull functions and specify the returned value as the value property of the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	this.Edit02.set_value(this.fn_fullToHalf(this.Edit00.value));
	this.Edit03.set_value(this.fn_halfToFull(this.Edit01.value));
};

4

Converting Full-width and Half-width Characters

Receive the input string, repeat the length determined by the length property value, check the Unicode value (charCodeAt), operate to convert it to full-width or half-width characters, and then convert it into ASCII character format (unescape).

this.fn_fullToHalf = function(sFull)
{
	var sHalf = "";
	var sChar = "";
	
	for (var i = 0; i < sFull.length; i++)	{
		sChar = sFull.charCodeAt(i);
		if (sChar == 12288)		{
			sHalf += unescape("%20");
		}
		else if ((sChar >= 65281) && (sChar <= 65374))		{
			sHalf += unescape("%" + (sChar-65248).toString(16));
		} else {
			sHalf += sFull.charAt(i);
		}
	}	
	return  sHalf;
}
this.fn_halfToFull = function(sHalf)
{
    var sFull = "";
    var sChar = "";
	
    for (var i = 0; i < sHalf.length; i++) {
		if ((sHalf.charCodeAt(i) >= 32) && (sHalf.charCodeAt(i) <= 126)) {
            if (sHalf.charCodeAt(i) == 32) {
                sChar = unescape("%u"+(12288).toString(16));
            } else {
                sChar = sHalf.charCodeAt(i) + 65248;
            }
        } else {
            sChar = sHalf.charCodeAt(i);
        }    
        if (sHalf.charCodeAt(i) == 32) {
            sFull = sFull + (sChar);
        }  else  { 
            sFull = sFull + String.fromCharCode(sChar);
        }
    }
    return sFull;
}

5

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the converted text.

Filling with Other Characters to Specified Length

In some cases, you need to enter the string with a certain number of digits. Using the method described in the example, it is possible to automatically fill in the leading "0" by simply entering "1" in the item where "01" is required.

Example

Enter the string, select the length, and click the button to display the string filled with "*" characters on the left and right.

sample_string_04.xfdl

Core features used in the example

padLeft, padRight

Fills the space on the left or right of the string with specific characters by the specified length. It does not work if the string is longer than the specified length.

How to implement an example

1

Configuring Form Screen

Place the Edit component, Spin component, and Button component. The Spin component is used to specify the length of the string. Set the value property value to 20.

2

Writing onclick Event Function of Button Component

In order to convert the input string, call the padLeft and padRight methods, and specify the returned value as the value property value of the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	this.Edit01.set_value(this.Edit00.value.padLeft(this.Spin00.value, "*"));
	this.Edit02.set_value(this.Edit00.value.padRight(this.Spin00.value, "*"));
};

3

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the converted text.

Removing Hyphens (-) in Strings

Let us take a look at how to remove hyphens from input strings.

Example

The character with a hyphen (-) is input and the corresponding character is removed and displayed.

sample_string_05.xfdl

Core features used in the example

replace

Able to replace the specified character with another character. Using regular expressions, you can replace multiple characters at the same time. The example uses the regular expression because it removes all hyphen characters.

How to implement an example

1

Configuring Form Screen

Place the Edit component and the Button component.

2

Writing onclick Event Function

Delete the hyphen (-) character from the input string.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var sRtn = this.Edit00.value;
	var sRomoveHyphen = sRtn.toString().replace(/[-]/g,"");
	this.Edit01.set_value(sRomoveHyphen);
};

You can also use the replaceAll method instead of the replace method.

var sRomoveHyphen = nexacro.replaceAll(sRtn, "-", "");

3

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the converted text.

Checking Validity of Resident Registration Number

Let us take a look at how the input string is validated according to the rules.

Example

When you enter the resident registration number, it is validated and the gender value is returned.

sample_string_06.xfdl

Core features used in the example

substr

Returns the string of the specified length from the specified location. It does not change the original string itself, though.

How to implement an example

1

Configuring Form Screen

Place the Edit component and the Button component.

2

Writing onclick Event Function

Validate the input string according to the specified rules. After verifying the validity of the resident registration number, if it is valid, check the gender and display it in the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var sJuminNo = this.Edit00.value;
	var returnValue = true;
	
	var arrChk  = [2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5];
	var sFNum 	= sJuminNo.substr(0,6).toString();
	var sLNum 	= sJuminNo.substr(6).toString();
	var sYY     = sFNum.substr(0,2);
	var sMM 	= sFNum.substr(2,2);
	var sDD 	= sFNum.substr(4,2);
	var sGenda 	= sLNum.substr(0,1);
	var nSum    = 0; 
	var sCC     = "20";
	
	if (sYY < "00" || sYY > "99" || sMM < "01" || sMM > "12" || sDD < "01" || sDD > "31") 
	{
		returnValue = false;
	}    
	
	if (sGenda < "1" || sGenda > "4") 
	{
		returnValue = false;
	}      
	
	if (sGenda == "1" || sGenda == "2")
	{
		sCC = "19"; 
	}
	
	if (this.fn_isYYYYMMDD(parseInt(sCC + sYY), parseInt(sMM), parseInt(sDD)) == false) 
	{
		returnValue = false;
	}          
	
	for (var i = 0; i < 12 ; i++)
	{
        nSum += parseInt(sJuminNo.substr(i, 1)) * arrChk[i];
		
	}
	
	nSum = 11 - (nSum % 11);
	nSum = nSum % 10;
	
	if (nSum != parseInt(sJuminNo.substr(12, 1)))
	{
		returnValue = false;
	}
	
	var sRtn;
	if(returnValue)
	{
		var vGender = sJuminNo.substr(6, 1);
		if (vGender == '1' || vGender == '3' || vGender == '5' || vGender == '7') 
		{
			sRtn = "M";
		} 
		else if (vGender == '2' || vGender == '4' || vGender == '6' || vGender == '8') 
		{
			sRtn = "W";
		} 
		else 
		{
			sRtn = "X";
		}
	}	else	{
		sRtn = "X";	
	}

    this.Edit01.set_value(sRtn);
};

Validate the part of the entered value that corresponds to the date.

this.fn_isYYYYMMDD = function(nYY, nMM, nDD) 
{
	switch (nMM) 
	{
		case 2:
			if (nDD > 29) 
			{
                return false;
            }
			if (nDD == 29) 
			{
                if ((nYY % 4) == 0) 
                {
                    if ((nYY % 100) != 0 || (nYY % 400) == 0) 
                    {
                        return false;
                    }
                } 
			}			
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			if (nDD == 31) 
			{
                return false;
			}
			break;
	}
	if(nMM > 12) return false;

	return true;
};

3

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the returned value.

Checking Validity of Corporate Registration Number

Let us take a look at how the input string is validated according to the rules.

The validation method of the corporate registration number follows the "Rules on the granting of registration numbers for real estate registration by corporations and overseas Koreans - Error search number calculation method".

Example

When you enter the corporate registration number, it is validated and the gender value is returned.

sample_string_07.xfdl

Core features used in the example

substr

Returns the string of the specified length from the specified location. It does not change the original string itself, though.

How to implement an example

1

Configuring Form Screen

Place the Edit component and the Button component.

2

Writing onclick Event Function

Validate the input string according to the specified rules. After verifying the validity of the corporate registration number, if it is valid, then check the gender and display it in the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var arrChk = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2];
	var Sum = 0; 
	var sComp = this.Edit00.value;
	
	for (var i = 0; i < 12; i++) 
	{
		Sum += arrChk[i] * sComp.charAt(i);
		
    }

	Sum = Sum % 10;
	trace("substring : " + sComp.substring(12, 13));
	Sum = 10 - Sum; 

	if (Sum > 5 )
	{ 
		Sum = 0;
    }
	if (Sum == sComp.substring(12, 13)) 
	{
		this.Edit01.set_value(true);
	}	else	{
		this.Edit01.set_value(false);
	}
};

3

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the returned value.

Checking NULL Value

Check if the entered string is a valid value.

Example

Return true if there is no input string. You can forcefully set empty, null, or undefined values by clicking the button.

sample_string_08.xfdl

Core features used in the example

undefined

undefined is the value given when the variable is created and the value is not specified. If you run the example and click the [NULL check] button immediately, then it is processed as undefined. If you look at the actual Edit00, then there is no property value called value.

How to implement an example

1

Configuring Form Screen

Place the Edit component and the Button component.

2

Writing onclick Event Function

Validate the input string according to the specified rules.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	this.Edit01.set_value(this.fn_checkNull(this.Edit00.value));
};

this.fn_checkNull = function(sValue)
{
	if (new String(sValue).valueOf() == "undefined")
	{
        return true;
    }
	
    if (sValue == null) 
    {
        return true;
    }
    
    var sChkStr = new String(sValue);
	
    if (sChkStr == null)
    {
        return true;
    }
	
    if (sChkStr.toString().length == 0 ) 
    {	
        return true;
    }
	
    return false;
};

3

Setting Invalid Value

Forcefully set the invalid value. When the [set undefined] button is clicked, the value of undefined is set as the value property value. At this time, then if you check the existence of the value property with the hasOwnProperty method, it returns the false value.

this.Button01_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	this.Edit00.set_value(null);
};

this.Button02_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	this.Edit00.set_value("");
};

this.Button03_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	this.Edit00.set_value(undefined);
	trace(this.Edit00.hasOwnProperty('value'));	
};

4

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the returned value.

Removing Blank Characters in the Front & Back

Remove blank characters before and after the input string.

Example

When the button is clicked, the result value is returned by removing blank characters from the front and back of the input string.

sample_string_09.xfdl

Core features used in the example

trim

The same result can be obtained by using the trim method of the String object instead of the fn_trim function in the example. However, the trim method cannot be used when the value is not set, such as null or undefined.

nexacro.trim

Similar to the trim method of the String object, but able specify the characters to be removed instead of blank characters. Running like nexacro.trim ("#TEST#","#") returns the string "TEST".

How to implement an example

1

Configuring Form Screen

Place the Edit component and the Button component.

2

Writing onclick Event Function

Remove blank characters from the input string.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	this.Edit01.set_value("*"+this.fn_trim(this.Edit00.value)+"*");
};

this.fn_trim = function(sValue)
{
    if (sValue == null)
    {
        return "";
    }
    if (new String(sValue).valueOf() == "undefined")
    {
        return "";
    }
    if (new String(sValue) == null)
    {
        return "";
    }

    var retVal = (new String(sValue)).replace(/^\s+|\s+$/g, '');
    return retVal;
}

3

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the returned value.

Checking for Number Format

Check if the entered string is a number.

Example

Check if the entered string is a number and display the result. The result of the nexacro.isNumeric method is also displayed. In the case of negative or decimal numbers, the nexacro.isNumeric method returns false.

sample_string_10.xfdl

Core features used in the example

isNumeric

Checks whether the entered character code or string is a number. There are restrictions on the range that can be checked.

charAt

This is used to check all characters included as long as the input string. Checks for symbols indicating negative or positive numbers and whether decimal points are contained.

How to implement an example

1

Configuring Form Screen

Place the Edit component and the Button component.

2

Writing onclick Event Function

Check whether the input string is a number and display the result in the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var strchecknumber = this.fn_checkNumber(this.Edit00.value);
	var strisNumeric = nexacro.isNumeric(this.Edit00.value);
	this.Edit01.set_value(strchecknumber+', '+strisNumeric);
};

this.fn_checkNumber = function(sNum)
{
	var sChar;
	var nCnt = 0;
	var bRtn;
	
    for (var i = 0; i < sNum.length; i++) 
    {
        sChar = sNum.charAt(i);
		
        if (i == 0 && (sChar == "+" || sChar == "-" )) 
        {
            bRtn = true;
        } 
        else if (sChar >= "0" && sChar <= "9") 
        {
            bRtn = true;
        } 
        else if (sChar == ".") 
        {
            nCnt++;
            if (nCnt > 1)	
            {
                bRtn = false;
                break;
            }
        } 
        else 
        {
            bRtn = false;
            break;
        }
    }
	
    return bRtn;
}

3

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the returned value.

Checking for English or Numeric

Check whether the entered string is English or numeric.

Example

Check whether the input string is English or numeric and display the result.

sample_string_11.xfdl

Core features used in the example

charCodeAt

Returns the Unicode value of the character corresponding to the specified index in the string.

How to implement an example

1

Configuring Form Screen

Place the Edit component and the Button component.

2

Writing onclick Event Function

Check whether the input string is a number and display the result in the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var bRtn = this.fn_checkAlpaNum(this.Edit00.value);	
    this.Edit01.set_value(bRtn);
};

this.fn_checkAlpaNum = function(sString) 
{
    var sVal = "";
	var bVal = false;
	
    for (var i = 0; i < sString.length; i++) 
    {
		var sVal = sString.charCodeAt(i);
        if ((sVal >= 48 && sVal <=57) || (sVal >=65 && sVal <= 90) || (sVal >= 97 && sVal <= 122)) 
        {
            bVal = true;	
        }
        else
        {
            bVal = false;
            break;
        }
    }
	return bVal;
}

https://en.wikipedia.org/wiki/ASCII#Character_set

From 48 to 57 are numbers from 0 to 9

From 65 to 90 are English uppercase letters and from 97 to 122 are English lowercase letters

3

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the returned value.

Checking Validity of Date & Time

Check if the entered string is a valid date and time value.

Example

Check if the entered string is a valid date and time value and display the result.

sample_string_12.xfdl

Core features used in the example

substr

Returns the string of the specified length from the starting location index. In the example, it is assumed that text is entered in the format YYYY-MM-DD.

How to implement an example

1

Configuring Form Screen

Place the Edit component and the Button component.

2

Writing onclick Event Function

Check whether the input string is the valid date value and display the result in the Edit component.

this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var bRtn = this.fn_checkDate(this.Edit00.value);	
    this.Edit01.set_value(bRtn);
};

this.fn_checkDate = function(sDate) 
{
    var nYear  = Number(sDate.toString().substr(0,4));
    var nMonth = Number(sDate.toString().substr(5,2));
    var nDate  = Number(sDate.toString().substr(8,2));
	
    if ( nMonth > 12 || nMonth < 1)
    {
		return false;
    }
    
    switch (nMonth) 
    {
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			if (nDate > 31 || nDate < 1)
			{
				return false;
			}
			break;
		case 4: 
		case 6: 
		case 9: 
		case 11:  
			if (nDate > 30 || nDate < 1)
			{
				return false;
			}                               
			break;
		case 2:   
			if (((nYear % 4 == 0) && (nYear % 100 != 0)) || (nYear % 400 == 0))
			{
				if (nDate > 29 || nDate < 1)
				{
					return false;
				}
			}
			else
			{
				if (nDate > 28 || nDate < 1)
				{
					return false;
				}
			}                              
			break;            
		default:
			break;
    }    
    return true;
}

In the case of February, check if it is the leap year. The leap year is the year divided by 4, not divided by 100, hence, divided by 400.

Check whether the input string is the valid time value and display the result in the Edit component.

this.Button01_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo)
{
	var bRtn = this.fn_checkTime(this.Edit02.value);	
    this.Edit01.set_value(bRtn);
};

this.fn_checkTime = function(sTime) 
{
    var nHH = Number(sTime.toString().substr(0,2));
    var nMM = Number(sTime.toString().substr(3,2));
    var nSS = Number(sTime.toString().substr(6,2));
	
    if (nHH > 24 || nHH < 0)
    {
		return false;
    }    
    
    if (nMM > 59 || nMM < 0)
    {
		return false;
    }
    
    if (nSS > 59 || nSS < 0)
    {
		return false;
    }  
    return true;
}

3

Checking with QuickView

Run it with QuickView (Ctrl + F6) and click the button to check the returned value.