Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Replacing an &


Message #1 by "Drew, Ron" <RDrew@B...> on Tue, 12 Nov 2002 08:49:10 -0500
Must be brain dead today.  Cant remember the actual command syntax...How
do I allow a "&" to be passed in a request.form?
I have a field being passed from a form using a request.form.   If the
person puts "Test & Output", only "Test" shows up
When I did a REPLACE (strTEXT, "&", "-")   it works OK but what the heck
can I change the "-" to in order to see the "&" in the name?
Thanks and wish it was Friday!!

Message #2 by "Ian: Future Proof Web Dev" <lists@f...> on Tue, 12 Nov 2002 14:10:59 -0000
REPLACE (strTEXT, "&", "&amp;")

should work for html, i think

----- Original Message -----
From: "Drew, Ron" <RDrew@B...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Tuesday, November 12, 2002 1:49 PM
Subject: [asp_web_howto] Replacing an &


> Must be brain dead today.  Cant remember the actual command syntax...How
> do I allow a "&" to be passed in a request.form?
> I have a field being passed from a form using a request.form.   If the
> person puts "Test & Output", only "Test" shows up
> When I did a REPLACE (strTEXT, "&", "-")   it works OK but what the heck
> can I change the "-" to in order to see the "&" in the name?
> Thanks and wish it was Friday!!
>
>
>

Message #3 by Shaun Steckley <ssteckley@e...> on Tue, 12 Nov 2002 09:01:43 -0500
Look at the functions:
	server.htmlencode
	server.urlencode


-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Tuesday, November 12, 2002 8:49 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Replacing an &


Must be brain dead today.  Cant remember the actual command syntax...How
do I allow a "&" to be passed in a request.form?
I have a field being passed from a form using a request.form.   If the
person puts "Test & Output", only "Test" shows up
When I did a REPLACE (strTEXT, "&", "-")   it works OK but what the heck
can I change the "-" to in order to see the "&" in the name?
Thanks and wish it was Friday!!


Message #4 by "Drew, Ron" <RDrew@B...> on Fri, 22 Nov 2002 09:49:21 -0500
Can you look at this...it still does not work...I have tried replacing
with &amp; and HtmlEncode as you can see..prior to the replace the
strBody has a Request.form field with "Ron Drew & Mickey Mouse" in
it...when the FORM action happens it stops with Ron Drew in the strBody
parameter.

<%@ Language=3DVBScript %>
<% Option Explicit %>
<%
Const strHeader =3D "Verify the Information and SEND the message:"
Dim strTo, strSubject, strBody, ix, formElementName, formElementValue
strTo =3D "RDrew@B..."
strSubject =3D "Test Request from Website"
Response.Write "<B><font color=3Dblue>Verify the Information and SEND 
the
message:<br><br>"
strBody =3D ( "Request submitted at " & Now() & vbCrLf & vbCrLf)

For ix =3D 1 to Request.Form.Count
    formElementName =3D Request.Form.Key(ix)
    formElementValue =3D Request.Form.Item(ix)
    if Len(formElementValue) > 0 then
        strBody =3D strBody & (formElementName & "=3D" & 
formElementValue &
vbCrLf)
    end if   
Next
strBody =3D Replace(strBody, vbCrLf, "<BR>")
strBody =3D Replace(strBody, "&", "&amp;")
strBody =3D Replace(strBody, "Request submitted", "PRESS SEND
ABOVE..submitted")
strBody =3D Replace(strBody, "<BR>", "%0D")

%>
<HTML><HEAD><META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
CHARSET=3Dwindows-1252">
<TITLE>Generic Mail Form</TITLE>
<script language=3D"JavaScript">
<!--
function Mistake() {
   window.history.go(-1);
}
//-->
</script>
</head>
<body leftMargin=3D14 topmargin=3D0 bgcolor=3D#c0c0c0>=09
<FORM name=3D"formmail" METHOD=3D"post"
ACTION=3D"mailto:<%=3DstrTo%>?subject=3D<%=3DstrSubject%>&body=3D<%=3DSer
ver.HTMLEnc
ode(strBody)%>">
<input type=3Dsubmit value=3D"Send the Information"><BR><BR>
<input TYPE=3D"button" VALUE=3D"Made a MISTAKE..Send me Back"
onClick=3D"Mistake()">
</form>
</body></html>

Thanks for the look!!!!

-----Original Message-----
From: Shaun Steckley [mailto:ssteckley@e...]
Sent: Tuesday, November 12, 2002 9:02 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Look at the functions:
	server.htmlencode
	server.urlencode


-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Tuesday, November 12, 2002 8:49 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Replacing an &


Must be brain dead today.  Cant remember the actual command syntax...How
do I allow a "&" to be passed in a request.form?
I have a field being passed from a form using a request.form.   If the
person puts "Test & Output", only "Test" shows up
When I did a REPLACE (strTEXT, "&", "-")   it works OK but what the heck
can I change the "-" to in order to see the "&" in the name? Thanks and
wish it was Friday!!



Message #5 by "TomMallard" <mallard@s...> on Fri, 22 Nov 2002 07:12:20 -0800
Use server.urlencode(), you shouldn't need to replace the &'s with &amp.
Server.htmlencode() turns any html in the form field into printable code on
the screen instead of executing the html as html.

tom mallard
seattle

-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Friday, November 22, 2002 6:49 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Can you look at this...it still does not work...I have tried replacing
with &amp; and HtmlEncode as you can see..prior to the replace the
strBody has a Request.form field with "Ron Drew & Mickey Mouse" in
it...when the FORM action happens it stops with Ron Drew in the strBody
parameter.

<%@ Language=VBScript %>
<% Option Explicit %>
<%
Const strHeader = "Verify the Information and SEND the message:"
Dim strTo, strSubject, strBody, ix, formElementName, formElementValue
strTo = "RDrew@B..."
strSubject = "Test Request from Website"
Response.Write "<B><font color=blue>Verify the Information and SEND the
message:<br><br>"
strBody = ( "Request submitted at " & Now() & vbCrLf & vbCrLf)

For ix = 1 to Request.Form.Count
    formElementName = Request.Form.Key(ix)
    formElementValue = Request.Form.Item(ix)
    if Len(formElementValue) > 0 then
        strBody = strBody & (formElementName & "=" & formElementValue &
vbCrLf)
    end if
Next
strBody = Replace(strBody, vbCrLf, "<BR>")
strBody = Replace(strBody, "&", "&amp;")
strBody = Replace(strBody, "Request submitted", "PRESS SEND
ABOVE..submitted")
strBody = Replace(strBody, "<BR>", "%0D")

%>
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html;
CHARSET=windows-1252">
<TITLE>Generic Mail Form</TITLE>
<script language="JavaScript">
<!--
function Mistake() {
   window.history.go(-1);
}
//-->
</script>
</head>
<body leftMargin=14 topmargin=0 bgcolor=#c0c0c0>
<FORM name="formmail" METHOD="post"
ACTION="mailto:<%=strTo%>?subject=<%=strSubject%>&body=<%=Server.HTMLEnc
ode(strBody)%>">
<input type=submit value="Send the Information"><BR><BR>
<input TYPE="button" VALUE="Made a MISTAKE..Send me Back"
onClick="Mistake()">
</form>
</body></html>

Thanks for the look!!!!

-----Original Message-----
From: Shaun Steckley [mailto:ssteckley@e...]
Sent: Tuesday, November 12, 2002 9:02 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Look at the functions:
	server.htmlencode
	server.urlencode


-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Tuesday, November 12, 2002 8:49 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Replacing an &


Must be brain dead today.  Cant remember the actual command syntax...How
do I allow a "&" to be passed in a request.form?
I have a field being passed from a form using a request.form.   If the
person puts "Test & Output", only "Test" shows up
When I did a REPLACE (strTEXT, "&", "-")   it works OK but what the heck
can I change the "-" to in order to see the "&" in the name? Thanks and
wish it was Friday!!






Message #6 by "Drew, Ron" <RDrew@B...> on Fri, 22 Nov 2002 11:00:18 -0500
Thanks Tom...tried it and the & now works but it is all one string with
a bunch of "+" signs (no line feeds as before in the email).  So I just
did a replace of "&" to "and" for now to make it work. 
Oh well..thanks for trying!!

-----Original Message-----
From: TomMallard [mailto:mallard@s...]
Sent: Friday, November 22, 2002 10:12 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Use server.urlencode(), you shouldn't need to replace the &'s with &amp.
Server.htmlencode() turns any html in the form field into printable code
on the screen instead of executing the html as html.

tom mallard
seattle

-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Friday, November 22, 2002 6:49 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Can you look at this...it still does not work...I have tried replacing
with &amp; and HtmlEncode as you can see..prior to the replace the
strBody has a Request.form field with "Ron Drew & Mickey Mouse" in
it...when the FORM action happens it stops with Ron Drew in the strBody
parameter.

<%@ Language=3DVBScript %>
<% Option Explicit %>
<%
Const strHeader =3D "Verify the Information and SEND the message:" Dim
strTo, strSubject, strBody, ix, formElementName, formElementValue strTo
=3D "RDrew@B..." strSubject =3D "Test Request from Website"
Response.Write "<B><font color=3Dblue>Verify the Information and SEND 
the
message:<br><br>" strBody =3D ( "Request submitted at " & Now() & vbCrLf 
&
vbCrLf)

For ix =3D 1 to Request.Form.Count
    formElementName =3D Request.Form.Key(ix)
    formElementValue =3D Request.Form.Item(ix)
    if Len(formElementValue) > 0 then
        strBody =3D strBody & (formElementName & "=3D" & 
formElementValue &
vbCrLf)
    end if
Next
strBody =3D Replace(strBody, vbCrLf, "<BR>")
strBody =3D Replace(strBody, "&", "&amp;")
strBody =3D Replace(strBody, "Request submitted", "PRESS SEND
ABOVE..submitted")
strBody =3D Replace(strBody, "<BR>", "%0D")

%>
<HTML><HEAD><META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html;
CHARSET=3Dwindows-1252"> <TITLE>Generic Mail Form</TITLE> <script
language=3D"JavaScript">
<!--
function Mistake() {
   window.history.go(-1);
}
//-->
</script>
</head>
<body leftMargin=3D14 topmargin=3D0 bgcolor=3D#c0c0c0>
<FORM name=3D"formmail" METHOD=3D"post"
ACTION=3D"mailto:<%=3DstrTo%>?subject=3D<%=3DstrSubject%>&body=3D<%=3DSer
ver.HTMLEnc
ode(strBody)%>">
<input type=3Dsubmit value=3D"Send the Information"><BR><BR>
<input TYPE=3D"button" VALUE=3D"Made a MISTAKE..Send me Back"
onClick=3D"Mistake()"> </form> </body></html>

Thanks for the look!!!!

-----Original Message-----
From: Shaun Steckley [mailto:ssteckley@e...]
Sent: Tuesday, November 12, 2002 9:02 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Look at the functions:
	server.htmlencode
	server.urlencode


-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Tuesday, November 12, 2002 8:49 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Replacing an &


Must be brain dead today.  Cant remember the actual command syntax...How
do I allow a "&" to be passed in a request.form?
I have a field being passed from a form using a request.form.   If the
person puts "Test & Output", only "Test" shows up
When I did a REPLACE (strTEXT, "&", "-")   it works OK but what the heck
can I change the "-" to in order to see the "&" in the name? Thanks and
wish it was Friday!!


---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 

---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 

---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 



Message #7 by "TomMallard" <mallard@s...> on Fri, 22 Nov 2002 08:44:35 -0800
Pluses are encoded spaces...you still need to replace the vbcrlf's and
unencode the results. It takes a while to sort it out but you can get it to
read the way you want later when time permits.

tom

-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Friday, November 22, 2002 8:00 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Thanks Tom...tried it and the & now works but it is all one string with
a bunch of "+" signs (no line feeds as before in the email).  So I just
did a replace of "&" to "and" for now to make it work.
Oh well..thanks for trying!!

-----Original Message-----
From: TomMallard [mailto:mallard@s...]
Sent: Friday, November 22, 2002 10:12 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Use server.urlencode(), you shouldn't need to replace the &'s with &amp.
Server.htmlencode() turns any html in the form field into printable code
on the screen instead of executing the html as html.

tom mallard
seattle

-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Friday, November 22, 2002 6:49 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Can you look at this...it still does not work...I have tried replacing
with &amp; and HtmlEncode as you can see..prior to the replace the
strBody has a Request.form field with "Ron Drew & Mickey Mouse" in
it...when the FORM action happens it stops with Ron Drew in the strBody
parameter.

<%@ Language=VBScript %>
<% Option Explicit %>
<%
Const strHeader = "Verify the Information and SEND the message:" Dim
strTo, strSubject, strBody, ix, formElementName, formElementValue strTo
= "RDrew@B..." strSubject = "Test Request from Website"
Response.Write "<B><font color=blue>Verify the Information and SEND the
message:<br><br>" strBody = ( "Request submitted at " & Now() & vbCrLf &
vbCrLf)

For ix = 1 to Request.Form.Count
    formElementName = Request.Form.Key(ix)
    formElementValue = Request.Form.Item(ix)
    if Len(formElementValue) > 0 then
        strBody = strBody & (formElementName & "=" & formElementValue &
vbCrLf)
    end if
Next
strBody = Replace(strBody, vbCrLf, "<BR>")
strBody = Replace(strBody, "&", "&amp;")
strBody = Replace(strBody, "Request submitted", "PRESS SEND
ABOVE..submitted")
strBody = Replace(strBody, "<BR>", "%0D")

%>
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html;
CHARSET=windows-1252"> <TITLE>Generic Mail Form</TITLE> <script
language="JavaScript">
<!--
function Mistake() {
   window.history.go(-1);
}
//-->
</script>
</head>
<body leftMargin=14 topmargin=0 bgcolor=#c0c0c0>
<FORM name="formmail" METHOD="post"
ACTION="mailto:<%=strTo%>?subject=<%=strSubject%>&body=<%=Server.HTMLEnc
ode(strBody)%>">
<input type=submit value="Send the Information"><BR><BR>
<input TYPE="button" VALUE="Made a MISTAKE..Send me Back"
onClick="Mistake()"> </form> </body></html>

Thanks for the look!!!!

-----Original Message-----
From: Shaun Steckley [mailto:ssteckley@e...]
Sent: Tuesday, November 12, 2002 9:02 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Replacing an &


Look at the functions:
	server.htmlencode
	server.urlencode


-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Tuesday, November 12, 2002 8:49 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Replacing an &


Must be brain dead today.  Cant remember the actual command syntax...How
do I allow a "&" to be passed in a request.form?
I have a field being passed from a form using a request.form.   If the
person puts "Test & Output", only "Test" shows up
When I did a REPLACE (strTEXT, "&", "-")   it works OK but what the heck
can I change the "-" to in order to see the "&" in the name? Thanks and
wish it was Friday!!


---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 

---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 

---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 







  Return to Index