Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question VBScript - CDONTS - Email Form

    Hi,

    I'm a beginner at VBScript but have been able to retrieve data entered in a form in an email. I have one problems with the form -

    Problem - I have 2 rows and 9 columns in part of my form. When I don't type anything in the columns let's say in the second row and I submit the form, I don't want to see the second row since no data was entered. The same with the first row, if no data was entered, I don't want to display the empty row or rows in the email. I've been working on this for days, and I can't figure out how to not display the empty row(s). I hope somebody can help.

    Here's the code:

    'Row 1
    Code:
    If (Request.Form) > "" Then
        strBody = strBody & "<tr><td height=40 align=center class=border><span class=txt>" & Request.Form("column1") & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column2")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column3") & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column4")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column5") & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column6")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column7")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column8")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column9")  & "&nbsp;" &"</span></td></tr>"
    
    End If
    
    
    'Row 2
    
    If (Request.Form) > "" Then
        strBody = strBody & "<tr><td height=40 align=center class=border><span class=txt>" & Request.Form("column1_r2") & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column2_r2")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column3_r2") & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column4_r2")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column5_r2") & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column6_r2")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column7_r2")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column8_r2")  & "&nbsp;" &"</span></td>"
         strBody = strBody & "<td align=center class=border><span class=txt>" & Request.Form("column9_r2")  & "&nbsp;" &"</span></td></tr>"
    
    End If
    ****
    Last edited by joe_main; 02-27-2006 at 02:04 AM.

  • #2
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I figured out the first problem but still have the second problem. Please somebody help!!!
    Last edited by joe_main; 02-27-2006 at 02:04 AM.

  • #3
    New Coder
    Join Date
    Apr 2004
    Location
    Columbus, Ohio
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This actually can be done fairly simple. I will try to explain, although I could probably just have you send me the code and I can do it for you and comment so you can see.

    To me it looks like you are Requesting a Form:

    The proper way to do this is:

    Code:
    Request.Form("formname")
    
    <form name="formname" id, etc...>
    Place the two rows with two different names:

    Code:
    If Request.Form("formname1") <> "" and Request.Form("formname2") <> "" then
       strContent = formcontent
       strContent = strContent & moreFormContect
       strContent = strContent & formcontent2
    else
       response.write "You have not filled out the forms correctly"
    end if
    I hope that helps, and with the code snipplet that you have provided it is limited on what I am thinking you mean.

    Jeff
    Hate something?
    Tell us about it
    Go Complain


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •