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 4598882
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:27:44+00:00 2026-05-21T23:27:44+00:00

How can I restrict any special characters entered in the textbox? I have a

  • 0

How can I restrict any special characters entered in the textbox?
I have a textbox where the user can enter in the textbox to validate if the url exists in the db. Before I hit the db I want to make sure there is no special characters entered in the textbox

for an example if some user try to enter something like:
)(*&<>&*^&*^&*$%#!@#$http://www.cnn.com!@#$%^&*()

Before they paste or type the url with special characters how can I not allowed in the textbox?

The only expection to this is: & (ampersand) is allowed if it is in between the url something like this:

http://cnn.com/news/latest.html&id=1
  • 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-05-21T23:27:45+00:00Added an answer on May 21, 2026 at 11:27 pm

    The simplest answer is to just make a method to strip characters on the client side.

    $('#myTextBox').keyup(function()
    {
         var santizedValue = '';
         for(var j = 0; j < this.value.length; j++)
            if(this.value[j].toLower() == 'a' || this.value[j].toLower() == 'b' ... )
               sanitizedValue += this.value[j];
    
            //Alternatively; convert the character to integer and check the ASCII range for a-z + &
    
         this.value = sanitizedValue;
    });
    

    You make a similar method on your server (just in case the client doesnt have javascript or defeats the script).

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

Sidebar

Related Questions

How can I restrict users from entering special characters in the text box. I
Why to restrict allowed usernames by different rules? For example why can't user have
Is there any way I can restrict a user to select files from only
Can you restrict a field from being updated without granting any additional user privileges
How can I restrict TextBox to accept only capital letters, or for example digits,
I want to make a simple program that can restrict any communication over the
Is there any way I can restrict my web application to certain cultures? So
I have a TextBox in WPF like so: <TextBox Height=48 /> Nothing special, looks
I have an iOS application where user can order prints of photos. User can
I have a PHP based website that uses coupon codes. I can restrict search

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.