Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Javascript - Validate forms - Quotes

Javascript - Validate forms - Quotes
Thread Tools
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status: Offline
Reply With Quote
Jul 22, 2003, 04:38 PM
 
I am wondering if anyone out there can tell me how/where I might find a JavaScript that searches a text input field in an HTML form for Quotes.

I do not want users to be allowed to type a quotation mark in to the field, however, they CAN type the html command for a quote
(the & followed by quot.

I tried to do the following inside a function and it didn't like the 3 quotes.

if (passedVal.charAt(i) == """) {
alert("You cannot use quotation marks in this field")
return false
}

Any suggestions on how to tweak this code to stop people from using the quotation marks and use the HTML command for a quote mark instead?

Peace,

O
B unce!
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jul 22, 2003, 05:05 PM
 
i think you can escape a quote using a \ or you can search in single quotes
= "\""
or
= '"'

--will
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:12 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2