Jump to content

Form of .html file and Code of .asp "Back-End" file


aamberker

Recommended Posts

Hi,Not sure whatz going wrong :) ... Here I go...Javascript tag and Form tag in .html file

<head><title>Testing</title><script LANGUAGE='JavaScript' TYPE='text/javascript'>function validate_form(){if((document.feedback.realname.value=="") || (eval(document.feedback.realname).value.charAt()==' ')) { window.alert("~ Please Enter your Name ~"); document.feedback.realname.focus(); return false;}else if( ! validateEMail(document.feedback.mail.value)){ window.alert("~ Please Enter a Valid E-mail ID ~"); document.feedback.mail.focus(); return false;}else if((document.feedback.company.value=="") || (eval(document.feedback.company).value.charAt()==' ') ){ window.alert("~ Please Enter your Company ~"); document.feedback.company.focus(); return false;}else if((document.feedback.feedback.value=="") || (eval(document.feedback.feedback).value.charAt()==' ') ){ window.alert("~ Please Enter your Comments ~"); document.feedback.feedback.focus(); return false;}return true;}function validateEMail(eMail){ var objRegExp=/(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i; //check for valid email return objRegExp.test(eMail);}</script></head>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<form action="form-backend.asp" method=get name="feedback" onsubmit="return validate_form()"><table style="width: 500px" cellspacing="8" cellpadding="0" bgcolor="#F2F2F2"><tr><td style="width: 97px" align="left">Name</td><td align="left"> <input name="realname" type="text" class="nametextbox" style="width: 170px; height: 25px" /></td></tr><tr><td style="width: 97px" align="left">Email</td><td align="left"> <input name="mail" type="text" class="nametextbox" style="width: 170px; height: 25px" /></td></tr><tr><td style="width: 97px" align="left">Company</td><td align="left"> <input name="company" type="text" class="nametextbox" style="width: 170px; height: 25px" /></td></tr><tr><td style="width: 97px" valign="top">Comments</td><td><textarea name="feedback" style="height: 104px; width: 240px" rows="1" cols="20" class="nametextbox"></textarea></td></tr><tr><td style="width: 97px"> </td><td align="left"><input type="image" name="Submit" value="Submit" src="new_images/submitbutton.png" onmouseover="over();" onmouseout="out();" id="hover"/></td></tr></table></form>
Back-End file of .asp { action="form-backend.asp" }
<%@ Language = "VBScript" %><% Dim Error, ErrorFlag, redirectError = "Please enter the following information: "ErrorFlag = 0If Request("realname") = "" Then If ErrorFlag = 1 Then Error = Error + ", " End If Error = Error + "Name" ErrorFlag = 1End IfIf Request("mail") = "" Then If ErrorFlag = 1 Then Error = Error + ", " End If Error = Error + "Email" ErrorFlag = 1End IfIf Request("company") = "" Then If ErrorFlag = 1 Then Error = Error + ", " End If Error = Error + "Company" ErrorFlag = 1End IfIf Request("feedback") = "" Then If ErrorFlag = 1 Then Error = Error + ", " End If Error = Error + "Comment" ErrorFlag = 1End IfIf ErrorFlag = 1 Then redirect = "http://www.DOMAIN.com/home.html?realname=" + Request("realname") + "&mail=" + Request("mail") + "&mail=" + Request("feedback") + "&Error=" + Error Response.Redirect(redirect)Else 'Set Con1 = Nothing 'Set Con1 = Server.CreateObject("ADODB.Connection") 'ConnStr = "filedsn=" & Server.MapPath("TESTaa.dsn") 'ConnStr = ConnStr & ";DBQ=" & Server.MapPath("TESTbb.mdb") 'Con1.Open ConnStr 'excommand = "INSERT INTO bookingform VALUES ('" + Request("realname") + "','" + Request("mail") + "','" + Request("company") + "','"+ Request("feedback") + "')" 'Con1.execute excommand 'Con1.close 'set Con1 = Nothing Set objmail = CreateObject("CDONTS.Newmail") objmail.From = "??????????" + Request("mail") + "??????????" objmail.To = "webmaster@DOMAIN.com" objmail.Cc = "info@DOMAIN.com" objmail.Bcc = "ceo@DOMAIN.com" objmail.Subject ="~ Visitor's Question from "Contact Us" page ~" objmail.Body = "Name = " + Request("realname") + vbCrLf + "Email= " + Request("mail") + vbCrLf + "Company= " + Request("company") + vbCrLf + "Comment= " + Request("feedback") on error resume next objmail.Send if err.number <> 0 then on error resume next objmail.Send 'Retry once end if Set objmail = Nothing Response.redirect("http://www.DOMAIN.com/home.html")%><html><head><meta name="Microsoft Border" content="none"></head><body><%= excommand%><p> </body></html><%End IF%>
So??? :) Please advice :mellow:
Link to comment
Share on other sites

Could you tell us what is wrong? Do you get errors?
Hi aspnetguy,Upon hitting the "Submit" button in .html file, I am not receiving / getting the filled data by visitors :wub: ... Perhaps I might have done something wrong in back-end file :):):wub: Soo??? :mellow:
Link to comment
Share on other sites

Does your server support ASP? Are you being sent to the ASP file in the first place? Are you seeing any errors?

Link to comment
Share on other sites

Does your server support ASP? Are you being sent to the ASP file in the first place? Are you seeing any errors?
Hi Synook,Server does support ASP? What does am I being sent to the ASP file in the first place mean? NOPE!!!... I am not seeing any errors but somehow I am not getting the FILLED INFORMATION from .html page to my E-mail address...I am not sure but it seems to be that have done something wrong in back-end file of .asp or perhaps in JavaScript in .html file... wheww!!!
Link to comment
Share on other sites

I just tested all the html/javascript you posted. No problems. I hit submit, and since it's a GET method, a great big query string appears in my url box.If the same big query string appears in your url box, then it is not in the html.Can you comment out a bunch of your asp and try printing your get variables just to see if they arrived?

Link to comment
Share on other sites

I just tested all the html/javascript you posted. No problems. I hit submit, and since it's a GET method, a great big query string appears in my url box.If the same big query string appears in your url box, then it is not in the html.Can you comment out a bunch of your asp and try printing your get variables just to see if they arrived?
Hi Deirdre's Dad,Thanks for your response. Glad to know that you tested the "HTML - JavaScript" and no problems with it... But did you test the "form-backend.asp" [backend] file???I did not understand what you mean :) ... Could you please explain in a different way???
Link to comment
Share on other sites

Server does support ASP? ... NOPE!!!
Wait if your server does not support ASP then of course this script won't work, you'll have to find a host which does support ASP.Also, are you sure your host does support scripts sending emails? Some don't for security reasons.Does your host even have an SMPT server in the first place? Just checking...
Link to comment
Share on other sites

Wait if your server does not support ASP then of course this script won't work, you'll have to find a host which does support ASP.Also, are you sure your host does support scripts sending emails? Some don't for security reasons.Does your host even have an SMPT server in the first place? Just checking...
Are you seeing any errors?
Hence I said NOPE!!!Server does supports ASP. Well, now how do I check whether my host have an SMPT server or nope??? Please let me know your email ID via PM followed by will send you the .html and .asp files.Thanks.
Link to comment
Share on other sites

Please let me know your email ID via PM followed by will send you the .html and .asp files.
Just attach them, easier (and then other people can help too).Ask your host about the SMPT server and whether they restrict scripts sending emails.
Link to comment
Share on other sites

Just attach them, easier (and then other people can help too).Ask your host about the SMPT server and whether they restrict scripts sending emails.
Looking around how to attach files... [YUP!!!... MAKES SENSE other people helping too]...Okay... Will check with them and revertback but wondering how to attach files in forum... ???
Link to comment
Share on other sites

Hmm indeed it seems you can't. Why do I keep getting the feeling that this forum's software is somehow outdated..?Actually, I'm not the best person to help you here as I don't know much ASP.

Link to comment
Share on other sites

Hmm indeed it seems you can't. Why do I keep getting the feeling that this forum's software is somehow outdated..?Actually, I'm not the best person to help you here as I don't know much ASP.
I can attach to a New Posting but not to reply messages...FYI - This Forum's Software is NOT an outdated.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...