Mailform problem need help.

Results 1 to 3 of 3

Thread: Mailform problem need help.

  1. #1
    Bernd Guest

    Default Mailform problem need help.

    I have a html-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, when data come from a html-form <BR>Thank`s in advance.

  2. #2
    Join Date
    Dec 1969
    Posts
    168

    Default Javascript solution

    &#060;html&#062;&#060;head&#062;&#060;title&#062;L ogin&#060;/title&#062;<BR>&#060;script language="JavaScript1.2"&#062;&#060;!--<BR>function validate(form) {<BR> var str = login.email.value; <BR> var re = /^w+@w+(.w+)+$/;<BR><BR> if (login.name.value == "") {<BR> alert("Please enter your Name.");<BR> login.name.focus();<BR> return false;<BR> }<BR> else {<BR> if(login.email.value == "") {<BR> alert("Please enter your email address.");<BR> login.email.focus();<BR> return false;<BR> }<BR> else {<BR> if (re.test(str) == 0) {<BR> alert("" + str + " is an invalid email address!");<BR> login.email.select();<BR> login.email.focus();<BR> return false;<BR> }<BR> }<BR> }<BR>}<BR>&#060;/script&#062;<BR>&#060;/head&#062;<BR><BR>&#060;body&#062;<BR>&#060;form action="" method="post" name="login" onSubmit="return validate(this)"&#062;<BR>&#060;b&#062;Name:&#060;/b&#062; &#060;input type="text" name="name"&#062;&#060;p&#062;<BR>&#060;b&#062;Ema il:&#060;/b&#062; &#060;input type="text" name="email"&#062;&#060;p&#062;<BR>&#060;input type="submit"&#062;<BR>&#060;/form&#062;<BR>&#060;/body&#062;&#060;/html&#062;<BR><BR><BR>~~~~~ Hope this helps... Cheers!

  3. #3
    Bernd Guest

    Default RE: Javascript solution

    A good solution but I have a html-form where I have insert 3 &#060;form action&#062; tags. Each tag contact a different 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
  •