Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 August 10th, 2005, 12:19 AM
Registered User
 
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default Text Replacement Problem.

HI All,

I m using flw func to store text in db.
Function StoreText(theText)
    StoreText = ""
    on error resume next
    StoreText = CStr(theText)
    if (len(StoreText) > 0) Then
      StoreText = Replace(StoreText, """", """, 1, -1, 1)
      StoreText = Replace(StoreText, "'", "''", 1, -1, 1)
      StoreText = Replace(StoreText,"<","&lt;", 1, -1, 1)
      StoreText = Replace(StoreText,">","&gt;", 1, -1, 1)
      StoreText = Replace(StoreText, vbCrLf, "<BR>", 1, -1, 1)
    end if
End Function

now problem comes when i want to edit the text stored by this function and that prob is only for ", since this is replace by &quote; when user tries to modify text, it gets value with &quote; e.g.stored text is - I will "call" u. Will be display like - I will &quote;call&quote; u.

Thanks in advace.

Rupen Anjaria.
We CAN'T avoid problems, but can solve it.
 
Old August 10th, 2005, 12:26 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Hi
while retreiving the data r u using any function? Because when u display the data for editing, you need to replace "&quot;" with """"

Om Prakash
 
Old August 11th, 2005, 04:32 AM
Registered User
 
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

HI,
Ofcourse, I am using a function:
---------------
Function EditMemo(theText)
    EditMemo = ""
    on error resume next
    EditMemo = CStr(theText)
    if (len(EditMemo) > 0) Then
      EditMemo = Replace(EditMemo,"<br>",vbCrLf, 1, -1, 1)
      EditMemo = Replace(EditMemo, "&quot;", "CHR(32)", 1, -1, 1)
      EditMemo = Replace(EditMemo,"&lt;","<", 1, -1, 1)
      EditMemo = Replace(EditMemo,"&gt;",">", 1, -1, 1)
      EditMemo = Replace(EditMemo, "''","'", 1, -1, 1)
    end if
End Function
----------------
The prob is with :
      EditMemo = Replace(EditMemo, "&quot;", """", 1, -1, 1)
I have to replace &quot; with "

I hope to be clear now!!


Rupen Anjaria.
We CAN'T avoid problems, but can solve it.
 
Old August 11th, 2005, 06:53 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Hi,
This is what i understand with your comments:
You use StoreText function to convert your text before storing in database and use EditMemo to get the data into a textbox.

When you use StoreText, to store, the instead of double quotes, "&quot;" is stored in the database. While displaying this in a text box, in EditMemo function, how r u getting the data as "&quote;"..?

Please remove the following line form EditMemo function:

EditMemo = Replace(EditMemo, "&quot;", "CHR(32)", 1, -1, 1)

To display double quotes in a textbox, you need to use &quot;
This string will be displayed properly in the textbox:

- I will &quot;call&quot; u.

Hope this will help..



Om Prakash
 
Old August 12th, 2005, 04:00 AM
Registered User
 
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

HI,
I think u r getting confu with this, EditMemo is used to edit/modify the text entered by user, say i have written something and i want to modify that.
so while getting data in a textbox or textarea i have to convert &quote; to ", else text will be displayed awkward.

I hope this suffiece!!:)

Rupen Anjaria.:)
------------------
We CAN'T avoid problems, but can solve it.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacement for DDE mackas.net VB.NET 2 July 20th, 2010 11:39 AM
Problem about replacement of already loaded js helpless_freshman Javascript 7 August 31st, 2007 08:14 PM
Dynamic replacement of attribute value Satyajit Sahu XSLT 3 July 13th, 2007 12:54 PM
VISTA NetSend Replacement in VB? Ron Howerton VB How-To 1 April 13th, 2007 01:46 AM
Replacement beyondforsaken VB How-To 0 June 14th, 2003 10:16 AM





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