473,320 Members | 1,861 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,320 software developers and data experts.

restrict inverted commas in textbox

I've a textbox field, where user enters his name. I want to restrict
him from entering double and singls inverted commas.What kind of
function should i write.

Jul 6 '06 #1
3 2536
di******@yahoo.com wrote:
I've a textbox field, where user enters his name. I want to restrict
him from entering double and singls inverted commas.What kind of
function should i write.
If you want to do this to prevent the input from breaking a server-side
script, then you mustn't use javascript. Validate the input on the
server side instead. Otherwise, people without javascript will still
enter the invalid characters and your server-side code will break.

If that's not the case, you can use something like this:

<input type="text" onkeyup="this.value=this.value.replace(/\'/g, '')" />

Jeremy
Jul 6 '06 #2
Jeremy wrote:
di******@yahoo.com wrote:
>I've a textbox field, where user enters his name. I want to restrict
him from entering double and singls inverted commas.What kind of
function should i write.
If you want to do this to prevent the input from breaking a server-side
script, then you mustn't use javascript. Validate the input on the
server side instead.
Using JavaScript for this is not a problem.
Depending on JavaScript for this is.

A client side check can speed things up for the user and save server round
trips. The cost is that the function has to be implemented twice.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 6 '06 #3
David Dorward wrote:
Using JavaScript for this is not a problem.
Depending on JavaScript for this is.

A client side check can speed things up for the user and save server round
trips. The cost is that the function has to be implemented twice.
Thanks for the clarification. That's what I meant, but it came out a
bit glib.

Jeremy
Jul 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jon Maz | last post by:
Hi, A quick one: If you are forming a dynamic sql statement using parameters from a web form, you would normally double up any single inverted commas inputted by the user to stop sql...
2
by: weird0 | last post by:
I have to create a string that contains inverted commas inside it. How can i do that in c#? As follows:- "AT+CMGF=1" string temp=""AT+CMGF=1""; // not valid
1
by: =?Utf-8?B?Qw==?= | last post by:
I want to restrict the user entering nonalphanumeric keys using Javascript onKeypress. One exception is that I want to allow the user to enter spaces. How can I do this? Thanks in Advance.
3
by: sasimca007 | last post by:
Hello friends, We have seen many textboxes, it is used as date,readonly,text etc... If we want to restrict the textbox with not to enter letters only numbers and one more...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.