Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 22nd, 2008, 01:34 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 112
Thanks: 12
Thanked 0 Times in 0 Posts
Default Text box question???

Hi to all...

I have a few text box's on my site and i would like to know how can i replace if a user enters a single quote ' and re-place it with nothing...

The problem i'm having is when a user enters a single quote i get an error on the page because this info gets inputed into a database...

Hope someone can help me...

Rino

 
Old May 23rd, 2008, 03:39 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well you could trap the keypress or keydown event and replace the value in the box but it's not safe or user friendly. If you are using stored procedures and parameters then ' should be automatically be handled. If you're using dynamic SQL, poor practice in any case, then you normally need to double them up to '' (that's two single quotes) in your server-side code.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Adding Fields to a Text Box Question ausmoran BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 December 1st, 2005 06:15 PM
Extract text from text file & put in dropdown box tsukey Beginning PHP 5 July 20th, 2004 09:49 PM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.