How to accept half , full width alphanumeric characters as user input in Japan& ENG?
Application Type
Traditional Web, Mobile, Reactive
Service Studio Version
11.54.30 (Build 62899)

I'm creating a application In which the user can enter the username in both English and Japan

Username is accepted if the inputs are alphanumeric with no special characters involved.

Eg ;

Usernames like  Vijay , Vijay123 ,  ビジェイ   ,ジェイクマール123  are accepted 

Usernames like Vijay_ ,ジェイクマ@,Vijay-123 , ジェイクマール@123 should not be accepted

I've tried to create this using Regex.., But it's Identifying English Hyphen as a Japanese word

Thank you for your time

Hi Vijay,

You can restrict user entering hyphen in username input, to do that add the following javascript to onready event of page where user giving username and pass widgetId of username Input.

var InputField = document.getElementById($parameters.WidgetId);InputField.addEventListener("keydown", function(e) {    keypressed = e.keyCode || e.which || e.charCode;    if (keypressed == 189) {       e.preventDefault();     }})

this will restrict user entering hyphen and then you have to allow hyphen in regex so that it will allow hyphen like japanese character and above javascript will restrict entering english hyphen.

note: this will not work if you are using mozilla browser.



Thank You so much for your response Pramod

Hi Vijay,

There's no out-of-the-box easy way to do this, as regex typically doesn't handle non-Latin characters very well. You could either create an extension in .NET to check for valid strings, or create an ad-hoc loop (with an index) that takes the substring of each character, and check whether the character is in the right range.

Thank You so much for your response Killian


Hi @Vijay Raj ,

Please check this component JavaScript Regex

Let me know if you have facing any issue.



Thank You so much for your response Amit
"Allow Alpha Numeric With Space " solved my problem fully.

Can I get help to build it from the scratch or can I get the code for this entire application.

Thanks again for your time and help.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.