Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The Infamous TICK MARK ( ' )

Status
Not open for further replies.

JrClown

Technical User
Oct 18, 2000
393
US
Hello all. Here's my Q.

How can I make (or force) my ASP Pages script to accept a Tick Mark (') when typed ???

Example:
...........................................................
Name:This is a text field
Comments:This is a text field also

When the user types a tick either as part of their name and\or as part of the comments field, my scripts throw an error, and it will not take the tick at all.

Can you help me on this one? Thanks in advance.
Javascript or VBScript will be fine.











QUOTE OF THE DAY
Don't waste time telling people what you are doing or what you are going to do. Results have a way of informing the world.

<%
Jr Clown :eek:)
%>
 
When you do two tick marks, it will print it as normal. Just to a replace(yourstring,&quot;'&quot;,&quot;''&quot;) to get it to work normally in SQL and other script. This also works with quote marks two. When you do two quote marks in a series in a string, it will print one without throwing an error. Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
I'm not sure I understood what you just said. Can you visibly show me an example of what you mean please?
Feel free to point where I must use your solution. Thanks

Here's the code I'm using now.

function changed_tick(fieldstring)
holdstring = &quot;&quot;
for x = 1 to len(fieldstring)
holdchar = mid(fieldstring,x,1)
if holdchar = chr(39) then
holdstring = holdstring &amp; &quot;' &quot; &amp; chr(43) &amp; &quot; char(39) &quot; &amp; chr(43) &amp; &quot;'&quot;
elseif holdchar = chr(34) then
holdstring = holdstring &amp; &quot;' &quot; &amp; chr(43) &amp; &quot; char(34) &quot; &amp; chr(43) &amp; &quot;'&quot;
else
holdstring = holdstring &amp; holdchar
end if
next

changed_tick = &quot;'&quot; &amp; holdstring &amp; &quot;%'&quot;
end function
QUOTE OF THE DAY
Don't waste time telling people what you are doing or what you are going to do. Results have a way of informing the world.

<%
Jr Clown :eek:)
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top