Forums

ASP

This topic is locked

form processing question...how to hide blank input

Posted 06 Oct 2003 06:17:21
1
has voted
06 Oct 2003 06:17:21 b b posted:
hello,

Question is:


I have an order form that I have the input from the form sent to an email, how do I not
have all the form elements sent to me? as in just the form elements
that are filled in/checked? I have had a very hard time finding any
answers to this. The best that I could come up with is:

'Suppressing empty fields
If you would prefer not to see the fields that were empty, add the
following hidden INPUT field to your form: <INPUT TYPE=HIDDEN
NAME='!noblank'>'

However, in putting this line of code into my form as in as a seperate
line it still sends everthing. If I name a particular form element
NAME='!noblank', this works but obviously it's only good for one
element. This when using jmail4

Here's the page that's going to act as the order form (not done yet) www.focusdesign.com/ade/msc/docs/catalog/product_cost.asp
and below is the jmail.asp script that's acting as the mailer. If you can help me with this I would really appreciate it.

thanks
Bob


"<%




first_name = Request.Form ("First_Name"
last_name = Request.Form ("Last_Name"
Adress = Request.Form ("Address"
City = Request.Form ("City"
Country = Request.Form ("Country"
Zip = Request.Form ("Zip"
Phone = Request.Form ("Phone"
Email = Request.Form ("Email"



message = message & "Thank you for your order from Marine Sound Control." & VBCrLf & VBCrLf
message = message & "Process:" & VBCrLf
message = message & "What we will do is calculate shipping costs and any taxes that may be applicable and add these to your order. At that time we will respond to your inquiry within 24 hours with a total and any specifics regarding shipping and any other issues that may relate to your order such as volume discounts." & VBCrLf & VBCrLf
message = message & "Payment:" & VBCrLf
message = message & "We accept checks, money orders, and credit cards." & VBCrLf
message = message & "Please go to www.focusdesign.com/ade/msc/docs/order.htm for complete information regarding payment options." & VBCrLf & VBCrLf
message = message & "Any questions or additional information you may need please contact us either at this email xxx@... or phone number. " & VBCrLf & VBCrLf

message = message & "Your order information:" & VBCrLf & VBCrLf



message = message & "First Name:" & Space(2) & first_name & VBCrLf
message = message & "Last Name:" & Space(2) & last_name & VBCrLf
message = message & "Address:" & Space(2) & Address & VBCrLf
message = message & "City:" & Space(2) & City & VBCrLf
message = message & "Country:" & Space(2) & Country & VBCrLf
message = message & "Zip Code:" & Space(2) & Zip & VBCrLf
message = message & "Phone:" & Space(2) & Phone & VBCrLf
message = message & "Email:" & Space(2) & Email & VBCrLf



Set JMail = Server.CreateObject("JMail.Message"
JMail.From = "Customer Survey Suggestions"
JMail.FromName = "MSC Order Form"
JMail.Subject ="JMail Test"
JMail.AddRecipient " "
'JMail.AddRecipient " "
JMail.Body = message
JMail.Send( "mail.focusdesign.com" )


on error resume next
if err then
response.Write err.Description
else


response.Write ("Thank you.. . Your request has been submited!"
end if
set JMail = Nothing
%>"

Replies

Replied 20 Dec 2003 17:12:33
20 Dec 2003 17:12:33 Jeremiah McAuliffe replied:
I am completely new to any kind of scripting and also have this problem. I see this was posted some time ago with no response, perhaps this will bump the topic? Please?

I am using the SmartMailer extension, but would like to get rid of all the extra space in the e-mails that get sent!
Thanks.
Replied 27 Jul 2006 11:13:35
27 Jul 2006 11:13:35 meenu susi replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hello,

Question is:


I have an order form that I have the input from the form sent to an email, how do I not
have all the form elements sent to me? as in just the form elements
that are filled in/checked? I have had a very hard time finding any
answers to this. The best that I could come up with is:

'Suppressing empty fields
If you would prefer not to see the fields that were empty, add the
following hidden INPUT field to your form: &lt;INPUT TYPE=HIDDEN
NAME='!noblank'&gt;'

However, in putting this line of code into my form as in as a seperate
line it still sends everthing. If I name a particular form element
NAME='!noblank', this works but obviously it's only good for one
element. This when using jmail4

Here's the page that's going to act as the order form (not done yet) www.focusdesign.com/ade/msc/docs/catalog/product_cost.asp
and below is the jmail.asp script that's acting as the mailer. If you can help me with this I would really appreciate it.

thanks
Bob


"&lt;%




first_name = Request.Form ("First_Name"
last_name = Request.Form ("Last_Name"
Adress = Request.Form ("Address"
City = Request.Form ("City"
Country = Request.Form ("Country"
Zip = Request.Form ("Zip"
Phone = Request.Form ("Phone"
Email = Request.Form ("Email"



message = message & "Thank you for your order from Marine Sound Control." & VBCrLf & VBCrLf
message = message & "Process:" & VBCrLf
message = message & "What we will do is calculate shipping costs and any taxes that may be applicable and add these to your order. At that time we will respond to your inquiry within 24 hours with a total and any specifics regarding shipping and any other issues that may relate to your order such as volume discounts." & VBCrLf & VBCrLf
message = message & "Payment:" & VBCrLf
message = message & "We accept checks, money orders, and credit cards." & VBCrLf
message = message & "Please go to www.focusdesign.com/ade/msc/docs/order.htm for complete information regarding payment options." & VBCrLf & VBCrLf
message = message & "Any questions or additional information you may need please contact us either at this email xxx@... or phone number. " & VBCrLf & VBCrLf

message = message & "Your order information:" & VBCrLf & VBCrLf



message = message & "First Name:" & Space(2) & first_name & VBCrLf
message = message & "Last Name:" & Space(2) & last_name & VBCrLf
message = message & "Address:" & Space(2) & Address & VBCrLf
message = message & "City:" & Space(2) & City & VBCrLf
message = message & "Country:" & Space(2) & Country & VBCrLf
message = message & "Zip Code:" & Space(2) & Zip & VBCrLf
message = message & "Phone:" & Space(2) & Phone & VBCrLf
message = message & "Email:" & Space(2) & Email & VBCrLf



Set JMail = Server.CreateObject("JMail.Message"
JMail.From = "Customer Survey Suggestions"
JMail.FromName = "MSC Order Form"
JMail.Subject ="JMail Test"
JMail.AddRecipient " "
'JMail.AddRecipient " "
JMail.Body = message
JMail.Send( "mail.focusdesign.com" )


on error resume next
if err then
response.Write err.Description
else


response.Write ("Thank you.. . Your request has been submited!"
end if
set JMail = Nothing
%&gt;"


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 03 Aug 2006 22:21:33
03 Aug 2006 22:21:33 Dan Berdusco replied:
This may be very time consuming but you could use a few IF statements around parts of your mailer code to check to see if the field was left blank when the form was filled out. Something like:
<pre id=code><font face=courier size=2 id=code>
If NOT Request.Form ("First_Name" = "" Then
message = message & "First Name:" & Space(2) & first_name & VBCrLf
End If
If NOT Request.Form ("Last_Name" = "" Then
message = message & "Last Name:" & Space(2) & last_name & VBCrLf
End If
If NOT Request.Form ("Address" = "" Then
message = message & "Address:" & Space(2) & Address & VBCrLf
End If

Etc., Etc...

</font id=code></pre id=code>
Replied 04 Aug 2006 12:53:17
04 Aug 2006 12:53:17 Wayne Hultum replied:
A similar soloution to Trevors

if first_name &lt;&gt;"" then message = message & "First Name:" & Space(2) & first_name & VBCrLf
if last_name &lt;&gt;"" then message = message & "Last Name:" & Space(2) & last_name & VBCrLf

Wayne

Reply to this topic