473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to allow all special characters in textbox only one time in JS?

Dear Programmers, please help me out in this scenario:-

I want my textbox should accept only special characters only once.

It means for example:

It should not allow '%' symbol more than once.

All the special characters should be allowed only once in my textbox in JS.

Thanx Inadvance.
Oct 1 '16 #1
3 2327
Dormilich
8,658 Expert Mod 8TB
you would first have to define what a "special character" is. then you would check on input if the put in character already exists in the textbox’ value.
Oct 2 '16 #2
Ohkay Thank You for your reply sir!!

But yesterday i was trying using RegEx. So Is it possible to restrict more than one same character in textbox using Regex?
Oct 4 '16 #3
Dormilich
8,658 Expert Mod 8TB
you would only need the RegExp to figure out if a character is a special character. then you would use String.indexOf() for the test.
Oct 4 '16 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Smith | last post by:
I have a table that contains a chunk of text, and the text commonly has special characters, such as "&" or "–". To edit this text, there is a page where the text is dumped into a textarea....
4
by: Ewok | last post by:
let me just say. it's not by choice but im dealing with a .net web app (top down approach with VB and a MySQL database) sigh..... Anyhow, I've just about got all the kinks worked out but I am...
5
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file"....
17
by: Carl Mercier | last post by:
Hi, Is it possible to use special characters like \n or \t in a VB.NET string, just like in C#? My guess is NO, but maybe there's something I don't know. If it's not possible, does anybody...
1
by: sonald | last post by:
Dear All, I am working on a module that validates the provided CSV data in a text format, which must be in a predefined format. We check for the : 1. Number of fields provided in the text file,...
1
by: Nick | last post by:
Hi All: I have a textbox in my web page, when user input "A & B" in this textbox, then click save button, then in the database it store as "A & B", which is good. Bu the problem is when i...
0
by: CodeMan007 | last post by:
Hi , I have a small application built using the JSP/Bean model and using MS Access as database. I have a page where the user can enter the errors and exceptions that the user is facing and submit...
13
by: titan nyquist | last post by:
How do you test a string to see if it contains special characters? I want to ensure that any names typed into my form has only letters (and maybe allow a dash and an apostrophe). I can loop...
1
by: ArizonaJohn | last post by:
Hello, I would like to allow users to add tables to my database with special characters in the table names. The characters I would like to allow include #, &, *, and +. Below is my code which...
11
Ajay Bhalala
by: Ajay Bhalala | last post by:
Hello experts, I have 1 form. In this form there is one textbox named "txtName" and 1 button named"btnCountChar" I want to count the special characters entered in the textbox. How can I do...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.