need help with mailform

Results 1 to 5 of 5

Thread: need help with mailform

  1. #1
    Bernd Guest

    Default need help with mailform

    I have a form, where people can fill out "name" and "email". If they don`t fill out name or email I want a respond like "please insert your name" or "please insert your email-adress". How is the correct code for this problem?<BR>Thank`s in advance.

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: need help with mailform

    There are two ways to do this: client-side javascript or server-side ASP. In client-side javascript, once they submit the form (by clicking the button that says "Submit", a validation routine can be run to make sure the data is correct. If it is not, a message box will appear explaining the problem and not let them submit the form until all their data is in wack.<BR><BR>There is an aricle and some sample code on 4Guys that shows you how to use client-side JavaScript to validate various types of form data.<BR><BR>Form Validation Using Javascript<BR>http://www.4guysfromrolla.com/webtech/091998-1.shtml<BR><BR>If you have any questions or problems with it, please respond to my post, and I and others will help further with this issue! :)

  3. #3
    Allan Ebdrup Guest

    Default RE: need help with mailform

    If you use method=post in your form and submit it to the same page that generates the form.<BR>You could do something like:<BR>------<BR>&#060;HTML&#062;<BR>&#060;HEAD&#062;<BR>&#060; TITLE&#062;Form test&#060;/TITLE&#062;<BR>&#060;/HEAD&#062;<BR>&#060;BODY&#062;<BR>&#060;%<BR>funct ion displayform(strName, strEmail)<BR>%&#062;<BR>&#060;form NAME="myForm" ACTION="thispage.asp" METHOD="post"&#062;<BR>&#060;table BORDER="0" CELLSPACING="0" CELLPADDING="0"&#062;<BR>&#060;tr&#062;<BR>&#060;t d&#062;&#060;i&#062;Name:*&#060;/i&#062;&#060;/td&#062;<BR>&#060;td&#062;&#060;input TYPE="text" NAME="name" SIZE="40" MAXLENGTH="255" value="&#060;%= strName %&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;tr&#062;<BR>&#060;td&#062;&#060; i&#062;Email:*&#060;/i&#062;&#060;/td&#062;<BR>&#060;td&#062;&#060;input TYPE="text" NAME="name" SIZE="40" MAXLENGTH="255" value="&#060;%= strName %&#062;"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;td COLSPAN="2" ALIGN="right"&#062;&#060;input TYPE="reset" VALUE="Clear Form"&#062;**&#060;input TYPE="submit" VALUE="Submit Form"&#062;&#060;/td&#062;<BR>&#060;/tr&#062;<BR>&#060;/table&#062;<BR>&#060;/form&#062;<BR>%&#062;<BR>end function<BR><BR>if isempty(request.form("name")) and isempty request.form("email") then<BR> displayForm("","") &#039display initial form<BR>else<BR> dim strName,strEmail,strError<BR> strName=trim(request.form("name")) &#039trims leading and trailing spaces<BR> strEmail=replace(request.form("name"), " ", "") &#039removes spaces<BR> If len(strName)&#060;2 then strError= strError & "Name must be two charecters or more<BR>"<BR> If len(strEmail)&#060;4 then strError= strError & "Email must be four charecters or more<BR>"<BR> if len(strError)&#062;0 then<BR> response.write strError<BR> displayform(strName,strEmail)<BR> else<BR> reponse.write "Data entered<BR>Name: " & strName & "<BR>Email: " & strEmail<BR> end if<BR>end if<BR>%&#062;<BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;<BR><BR>----------------------<BR>No testing done, check if it works<BR>-Allan Ebdrup<BR>http://www.norbergfestival.com - High quality festival in Sweden<BR>http://www.subcity.dk - Danish culture houses & night Clubs<BR>http://www.norbergfestival.dk/forum/ - Buy your own ASP discussion forum for only $19!

  4. #4
    Bernd Guest

    Default RE: need help with mailform

    Thanks for the script, but what is when the data come from a html-form?


  5. #5
    Bernd Guest

    Default RE: need help with mailform

    I have a html-form where I have insert 3 &#060;form action&#062; tags. Each tag contact a asp-mailform. When I Insert the code in all the 3 forms I get an error. What`s wrong.

Posting Permissions

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