By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,963 Members | 1,749 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,963 IT Pros & Developers. It's quick & easy.

Sendmail Script not working

Mr aldo
P: 15
Hello I have this Sendmail Script here that uses Javascript, so when a field is left empty it makes a pop up saying a field was left empty and you click OK but when you click OK it proccesses it and sends the email and I of course do want that done. Here is the code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script>
  4. function doSubmit()
  5. {
  6.     if (validateOne() == false)
  7.     {
  8.         alert("Forum username is required for application submission!");
  9.         return;
  10.     }
  11.     if (validateTwo() == false)
  12.     {
  13.         alert("Your e-mail address is required for application submission!");
  14.         return;
  15.     }
  16.     if (validateThree() == false)
  17.     {
  18.         alert("You need to fill out the text box");
  19.         return;
  20.     }
  21.     alert("Your application was sent successfully! ");
  22.     return;
  23. }
  24. function validateOne()
  25. {
  26.     if (document.Application.name.value == "") return false;
  27.     return false;
  28. }
  29. function validateTwo()
  30. {
  31.     if (document.Application.email.value == "") return false;
  32.     return false;
  33. }
  34. function validateThree()
  35. {
  36.     if (document.Application.text.value == "") return false;
  37.     return false;
  38. }
  39. </script>
  40. </head>
  41. <form name="Application" action="process.php" method="post">
  42. <font face="Arial">
  43.  
  44. Moderator Application form for theonlinefriendsforum.com
  45. <br>
  46. <br>
  47. Something: &nbsp&nbsp<input type="text" name="name" size="20" maxlength="20"><br>
  48. <br>
  49. Email Address**: &nbsp&nbsp<input type="text" name="email" size="30" maxlength="30"><br>
  50. <br>
  51. Info:<br><textarea name="text" name="text" cols="50" rows="10"></textarea><br>
  52. <input type="submit" name="submit" value="Send"
  53. onClick="doSubmit()">
  54. </form>
  55. <font size=2>**Required Information</font>
  56. </html>
I have tried changing some of the falses to true and the true to false but no success, I realy cannot make it so when it says you didnt fill out required and you Click OK it allows you to proceed on filling out the information.
Jul 27 '07 #1
Share this Question
Share on Google+
2 Replies


epots9
Expert 100+
P: 1,351
Hello I have this Sendmail Script here that uses Javascript, so when a field is left empty it makes a pop up saying a field was left empty and you click OK but when you click OK it proccesses it and sends the email and I of course do want that done. Here is the code:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script>
  4. function doSubmit()
  5. {
  6.     if (validateOne() == false)
  7.     {
  8.         alert("Forum username is required for application submission!");
  9.         return;
  10.     }
  11.     if (validateTwo() == false)
  12.     {
  13.         alert("Your e-mail address is required for application submission!");
  14.         return;
  15.     }
  16.     if (validateThree() == false)
  17.     {
  18.         alert("You need to fill out the text box");
  19.         return;
  20.     }
  21.     alert("Your application was sent successfully! ");
  22.     return;
  23. }
  24. function validateOne()
  25. {
  26.     if (document.Application.name.value == "") return false;
  27.     return false;
  28. }
  29. function validateTwo()
  30. {
  31.     if (document.Application.email.value == "") return false;
  32.     return false;
  33. }
  34. function validateThree()
  35. {
  36.     if (document.Application.text.value == "") return false;
  37.     return false;
  38. }
  39. </script>
  40. </head>
  41. <form name="Application" action="process.php" method="post">
  42. <font face="Arial">
  43.  
  44. Moderator Application form for theonlinefriendsforum.com
  45. <br>
  46. <br>
  47. Something: &nbsp&nbsp<input type="text" name="name" size="20" maxlength="20"><br>
  48. <br>
  49. Email Address**: &nbsp&nbsp<input type="text" name="email" size="30" maxlength="30"><br>
  50. <br>
  51. Info:<br><textarea name="text" name="text" cols="50" rows="10"></textarea><br>
  52. <input type="submit" name="submit" value="Send"
  53. onClick="doSubmit()">
  54. </form>
  55. <font size=2>**Required Information</font>
  56. </html>
I have tried changing some of the falses to true and the true to false but no success, I realy cannot make it so when it says you didnt fill out required and you Click OK it allows you to proceed on filling out the information.
change the button from type="submit" to type="button"
then in your javascript if everything is valid call the submit method

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("Application").submit();
  2.  
good luck
Jul 27 '07 #2

Mr aldo
P: 15
change the button from type="submit" to type="button"
then in your javascript if everything is valid call the submit method

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("Application").submit();
  2.  
good luck
Thanks i changed it from submit to button, but Im still new at this. Im not understanding where you put that Javascript code at
Jul 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.