I realize there is a lot of ASP code here, but, the resolution I'd like to come up with (Although a direct ASP solution would be great) seems to lead me to JavaScript.
I am having an issue attempting to get a single and double-quote value into a forms text input field. The web page is being drawn up under ASP.
The situation may arise that when pulling information from a DBMS, a particular field may have a single quote, double quote or both single and double quotes.
For example, a field may have
I have no problem returning the data and putting it to the screen so long this text is not going into an input text box. It comes out perfectly fine in straight HTML text.
I've tried using replace to change the single quote into two single quotes, right in the input box. (IE: value='Aren''t you "GOING" to do that work now?') I've tried switching things around so that I use value=" instead of value=', I've tried going to javascript and use something like replace(Val, "'", "+chr(39)+") within the ASP. Still no go. The field just comes up blank. Looking at the source, everything is alright.
So far, in the final source output, I've had the following:
[highlight]<script>document.CompanyForm.CompanyName.value='Company ''1 with a single quote';</script>[/highlight]
[highlight]<script>document.CompanyForm.CompanyName.value='Company '+chr(39)+'1 with a single quote';</script>[/highlight]
I've tried a couple other renditions from other sites pertaining to a function in the string unit, to no avail.
What little thing am I missing here??
The ASP attempt of code I've used is the following:
I really do need something that will check and apply the proper text to the input box for both single and double quotes.
Just to note, if there is no quote in the field, the input box is filled properly.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=
NEVER send the boss to do a techs job
I am having an issue attempting to get a single and double-quote value into a forms text input field. The web page is being drawn up under ASP.
The situation may arise that when pulling information from a DBMS, a particular field may have a single quote, double quote or both single and double quotes.
For example, a field may have
[highlight]Aren't you "GOING" to do that work now?[/highlight]
I have no problem returning the data and putting it to the screen so long this text is not going into an input text box. It comes out perfectly fine in straight HTML text.
I've tried using replace to change the single quote into two single quotes, right in the input box. (IE: value='Aren''t you "GOING" to do that work now?') I've tried switching things around so that I use value=" instead of value=', I've tried going to javascript and use something like replace(Val, "'", "+chr(39)+") within the ASP. Still no go. The field just comes up blank. Looking at the source, everything is alright.
So far, in the final source output, I've had the following:
[highlight]<script>document.CompanyForm.CompanyName.value='Company ''1 with a single quote';</script>[/highlight]
[highlight]<script>document.CompanyForm.CompanyName.value='Company '+chr(39)+'1 with a single quote';</script>[/highlight]
I've tried a couple other renditions from other sites pertaining to a function in the string unit, to no avail.
What little thing am I missing here??
The ASP attempt of code I've used is the following:
Code:
function WriteInput(Val,Name)
writeInput=vbcrlf&"<input type=text name="&Name&" maxlength=255 size=100>"
writeinput=writeinput&"<script language='JavaScript'>document.CompanyForm."&Name&".value='"
WriteInput=WriteInput&replace(val,"'","'+chr(39)+'")
WriteInput=WriteInput&"';</script>"
'WriteInput=vbcrlf&Val
end function
I really do need something that will check and apply the proper text to the input box for both single and double quotes.
Just to note, if there is no quote in the field, the input box is filled properly.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=
NEVER send the boss to do a techs job