Link to home
Create AccountLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Double Quotes - Help

Hello, I hope you can help me,...

I have the following code --

<%

dim notes
notes =  "&quot;"
notes = notes + trim(Left(RSNotes("Notes"),50))
notes = notes + "...&quot;<br/>"
notes = replace(notes,"<p>","")
notes = replace(notes,"</p>","")
notes = replace(notes,"“", "")

With response
.write("<a class=""inline"" href=""#deletenote"" title=""Delete Note"" onclick=""document.getElementById('NoteID').value = '" &(RSNotes("id"))& "';document.getElementById('notedetail').innerHTML='" &(notes)& " posted by " & (RSNotes("HQContact"))& " on " &  (RSNotes("Date"))& "'"">" & VbCrLf)
.write("Delete" & VbCrLf)
.write("</a>" & VbCrLf)
End With
%>

Open in new window


But it's getting broken, when the following code gets sent -

<p><span id="dtlview_Description">SB sent information pack 13/11/09.<br />New member pack posted 12/01/10 SB.</span></p>

Open in new window


I'm guesssing the issue here is -

<span id="dtlview_Description">

I've tried everything to replace the "...

Help!!
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

What is the exact error you are getting?
Avatar of garethtnash

ASKER

Hi Padas,

instead of a link that sais edit, i get --
<a class="inline" href="#editnote" title="Edit Document" onclick="document.getElementById('noteId').value = '117';document.getElementById('note').innerHTML='&lt;p&gt;&lt;span id=" dtlview_description"="">SB sent information pack 13/11/09.<br>New member pack posted 12/01/10 SB.</a>

Open in new window

I don't see anything in your code with "edit".  

Work backwards.  Start with the the code you want to end up with.  Then build your vb to create.  

This part of your rendered code looks wrong
 id=" dtlview_description"="">
Can you please try replacing line 3 -9 with code as provided:

dim notes
notes =  "&quot;"
notes = notes + trim(Left(test,50))
notes = notes + "...&quot;<br/>"
notes = replace(notes,"<p>","")
notes = replace(notes,"</p>","")
notes = replace(notes,"“", "")
notes = replace(notes,"""", "'")

Open in new window

Hi Padas,

Hope you had a good weekend?

So I changed the code to this --

<%
dim notes
notes =  "&quot;"
notes = notes + trim(Left(RSNotes("Notes"),50))
notes = notes + "...&quot;<br/>"
notes = replace(notes,"<p>","")
notes = replace(notes,"</p>","")
notes = replace(notes,"“", "")
notes = replace(notes,"""", "'")

With response
.write("<a class=""inline"" href=""#editnote"" title=""Edit Document"" onclick=""document.getElementById('noteId').value = '" &(RSNotes("id"))& "';document.getElementById('note').innerHTML='" &(notes)& "'"">" & VbCrLf)
.write("Edit" & VbCrLf)
.write("</a>" & VbCrLf)
End With

response.Write("|")		

With response
.write("<a class=""inline"" href=""#deletenote"" title=""Delete Note"" onclick=""document.getElementById('NoteID').value = '" &(RSNotes("id"))& "';document.getElementById('notedetail').innerHTML='" &(notes)& " posted by " & (RSNotes("HQContact"))& " on " &  (RSNotes("Date"))& "'"">" & VbCrLf)
.write("Delete" & VbCrLf)
.write("</a>" & VbCrLf)
End With
%>

Open in new window


Which gives me --

<a class="inline" onclick="document.getElementById('noteId').value = '117';document.getElementById('note').innerHTML='"<span id='dtlview_Description'>SB sent informat..."<br/>'" title="Edit Document" href="#editnote"> … </a>

Open in new window


but when I click the link, the fancybox opens with a '?', I'm guessing that this is because we have unclosed tags "<span id='dtlview_Description'>"

Should I strip these? Any idea how best to do this?

Thanks
The best thing to do is create a static link, then go backwards and build your vb.

I think this is the static link you want.

<a class="inline" onclick="document.getElementById('noteId').value = '117';document.getElementById('note').innerHTML=''<span id='dtlview_Description'>SB sent informat...<br></span>"; title="Edit Document" href="#editnote"> link here</a>

Open in new window

Hi,

I found a solution to this also...--

<%
Function stripHTMLtags(HTMLstring)

Set RegularExpressionObject = New RegExp

With RegularExpressionObject
.Pattern = "<[^>]+>"
.IgnoreCase = True
.Global = True
End With

stripHTMLtags = RegularExpressionObject.Replace(HTMLstring,"")
Set RegularExpressionObject = nothing

End Function
%>

Open in new window


But, to this I also need to remove line breaks (not <br/>), any suggestions Padas?

Thank you
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thank you