Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8717419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:18:07+00:00 2026-06-13T06:18:07+00:00

Textbox in jsp that allows only text numbers and comma. this is to seperate

  • 0

Textbox in jsp that allows only text numbers and comma.

this is to seperate userids.

each userid has to be 8 chars in length and i need to enter multiple userids in the textbox.

eg:

correct format is below

asakthi1,psubhadr,tpradee4

it should not end like(with a comma at the end.)(incorrect format)

asakthi1,psubhadr,tpradee4,

this i need to do using javascript.(No Jquery please.)

am scratching my head on this..Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:18:08+00:00Added an answer on June 13, 2026 at 6:18 am

    You could attach an onchange event handler to the <input type="text"> that will perform the validation using a regular expression like, for instance, this one: ^(([A-Za-z0-9]{8}),)*[A-Za-z0-9]{8}$.

    If a username is a combination of 8 letters or numbers, this expression would accept any number of usernames followed by comma, and at least one final username without a comma. Notice the {8} element forces a match of exactly 8 characters.

    If validation fails, it’s up to you how to show it to the user. This example will be showing an alert and clearing the input.

    <input type="text" onchange="if (!validate(this.value)) { alert('incorrect value'); this.value = ''; }">
    
    <script>
    function validate​(value){
        return value.match(new RegExp("^(([A-Za-z0-9]{8}),)*[A-Za-z0-9]{8}$")) != null;
    }​
    </script>
    

    Here is a sample JSFiddle to see the expression at work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a textbox that only allows an IP address. I can create this
The TextBox control offers a MaxLength property, which allows the insertable text into that
I have written a small JSP page that contains a text box and a
I have a simple search page with this text input form <form name=assetInput action=assetResult.jsp
<input type=text name=designation value=<%=request.getParameter(designation)%> ></input> In this JSP, I've send request parameters from an
Text in textbox and combobox do not render as they should be. Some letter
I have a text box in index.jsp and after writing something i am calling
I am autofilling second textbox based on first textbox in auto.jsp, similarly i want
In my jsp page i have one text box and two combo box. An
I'm building my own JSP Tag Library which need to support some features that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.