Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional 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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 13th, 2007, 12:09 PM
Registered User
 
Join Date: Sep 2007
Location: , , USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Single quote in function Parameter ASP -Javascript

Hi,

I am calling a javascript function having three parameter from asp page.

Response.write("<script>(ViewData ('03','hem's','N'));</script>"

If the second parameter value is having single quote, Its giving error.

How to pass this single quoted value from asp code to javascript?

Thanks in Advance.
Hem

Reply With Quote
  #2 (permalink)  
Old September 13th, 2007, 12:38 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Like this:

Response.write("<script>(ViewData ('03','hem\'s','N'));</script>")

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
Reply With Quote
  #3 (permalink)  
Old September 13th, 2007, 01:16 PM
Registered User
 
Join Date: Sep 2007
Location: , , USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply.

Is there any function which can be used to encode single quote?
I mean how to add '\' to the parameter values if single quote is there?

Hem96


Quote:
quote:Originally posted by dparsons
 Like this:

Response.write("<script>(ViewData ('03','hem\'s','N'));</script>")

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
Reply With Quote
  #4 (permalink)  
Old September 13th, 2007, 01:20 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Depends. If it is imperative for the quote to be there, you will need to do a string replace on the paramter and replace ' with \'

If the javascript function will still operate correctly without the physical presence of a quote you can use &quot hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
Reply With Quote
  #5 (permalink)  
Old September 14th, 2007, 09:10 AM
Registered User
 
Join Date: Sep 2007
Location: , , USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I need to show value with quote like " hem's" in the textbox
Replacing "'" with "\" will remove single quote.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting 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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
single quote problem harpua PHP Databases 1 July 8th, 2005 07:37 AM
How to add parameter val containing single quote prog ADO.NET 3 May 24th, 2005 09:24 AM
replace single Quote qadeerahmad General .NET 3 September 6th, 2004 08:10 PM
problem caused by single quote isheikh BOOK: Beginning ASP 3.0 1 April 16th, 2004 02:52 AM



All times are GMT -4. The time now is 11:40 PM.


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