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

ASP form problem: Mailing Failed... Error is: FromAddress Property cannot be blank

P: 3
Hi everyone,
I don't have a lot of experience with ASP and I was hoping someone could help me. I want to use our ASP form along with some javascript code to create a form where our patrons can select which department they will send the form to (we are trying to consolidate forms). This is what I have so far, but when I test the form, I keep getting this error message:
Mailing Failed... Error is:
FromAddress Property cannot be blank.

You can view/test the live form here:
http://myweb.twu.edu/~bklug/ask_test.htm

Any help is greatly appreciated.


Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script> 
  3. function formProcess(form1) 
  4.  /* More than 1 elm with name, so a collection is returned */ 
  5.  var elms = form.elements.recipientmail, selected; 
  6.  for(var k=-1, elm; elm=elms[++k];){ 
  7.   if(elm.checked) 
  8.    selected = elm; 
  9.  } 
  10.  
  11. /* If selected remains undefined (ie no selection made) */
  12. if(!selected){
  13. alert("Please select department");
  14. return false;
  15. }
  16. /* Else set action; allow submit */
  17. form.action = "mailto:"+selected.value;
  18. return true;
  19. }
  20. // bklug@mail.twu.edu
  21. </script>  <script>
  22. // JavaScript Document
  23.  
  24. /* This script and many more are available free online at
  25. The JavaScript Source!! http://javascript.internet.com
  26. Created by: wsabstract.com | http://www.wsabstract.com */
  27. function checkrequired(which) {
  28.   var pass=true;
  29.   for (i=0;i<which.length;i++) {
  30.     var tempobj=which.elements[i];
  31.     if (tempobj.name.substring(0,8)=="required") {
  32.       if (((tempobj.type=="text"||tempobj.type=="textarea")&&
  33.           tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
  34.           tempobj.selectedIndex==0)) {
  35.         pass=false;
  36.         break;
  37.       }
  38.     }
  39.   }
  40.   if (!pass) {
  41.     shortFieldName=tempobj.name.substring(8,30).toUpperCase();
  42.     alert("The "+shortFieldName+" field is a required field.");
  43.     return false;
  44.   } else {
  45.   return true;
  46.   }
  47. }</script> 
  48. </head>
  49.  
  50. <body>
  51. <h2>Ask a Librarian</h2>
  52.  
  53.    <form method=post action=http://www.twu.edu/cgi-bin/aspmail.asp id=form1 name=form1 enctype="text/plain" onSubmit="return (checkrequired(this) && formProcess(this))"> 
  54.  
  55. <input type=hidden name=sendername value="Automailer">
  56. <input type=hidden name=subject value="Distance Learning Request">
  57. <input type=hidden name=recipientname value="DL">
  58. <input type=hidden name=fromaddress value="webmaster@twu.edu">
  59. <input type=hidden name=redirect value=http://www.twu.edu/library/>
  60. <input type=hidden name=userinfo value="on">
  61.  
  62.  
  63.  
  64. The more information you provide on this form, the better we can serve you.<br />
  65.  
  66.  
  67. <table width="928" border="0" bgcolor="#cccccc">
  68. <tr> <td height="30"><span class="style3">*Required Field</span>
  69.       <span class="style3"></td>
  70.     <td></td>
  71.   </tr>
  72.     <td height="30">
  73.       <span class="style3">*</span><strong>Name:</strong></td>
  74.     <td><br /><input type="text" name="requiredname" size="50" /><br><br></td>
  75.   </tr>
  76.   <tr>
  77.     <td><b><span class="style3">*</span>Your Affiliation:</b></td>
  78.     <td><br />
  79.       <input type="radio" name="status" value="Student"> Student
  80. <input type="radio" name="status" value="Faculty"> Faculty
  81. <input type="radio" name="status" value="Staff"> Staff
  82. <input type="radio" name="status" value="Other"> Other<br /><br /></td>
  83.   </tr>
  84.   <tr>
  85.     <td><b>FACULTY/STAFF ONLY:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </b></td>
  86.     <td>
  87. <b><br />Department&nbsp;</b> 
  88.     <input type="text" name="department" size="35"/>
  89.  <b>&nbsp;&nbsp;Phone&nbsp;</b><input type="text" name="phone" size="35"/><br><br></td>
  90.   </tr>
  91.   <tr>
  92.     <td><b><span class="style3">*</span>Email Address :</b> </td>
  93.     <td><br /><br />    <input type="text" name="requiredemail" size="35"/><br>
  94.     <i>Your email address MUST be accurate for us to deliver information to you.</i><br /><br /></td>
  95.   </tr>
  96.   <tr>
  97.     <td height="62"><span class="style3">*</span><b>My question is about: </b></td>
  98.     <td>
  99. <input type="radio" name="recipientmail" id="addr0" value="bklug75@gmail.com"><label for="addr0">Register for Library Services</label><br />
  100. <input type="radio" name="recipientmail" id="addr1" value="bklug@mail.twu.edu"><label for="addr1">Research Paper</label><br />
  101. <input type="radio" name="recipientmail" id="addr2" value="bklug75@yahoo.com"><label for="addr2">Classroom Assignment</label>
  102. <br />
  103. <input type="radio" name="recipientmail" id="addr3" value="bklug75@gmail.com"><label for="addr3">Reporting Connection Trouble 
  104. to Databases</label><br />
  105. <input type="radio" name="recipientmail" id="addr4" value="bklug@mail.twu.edu"><label for="addr4">Distance Learning Services</label><br />
  106. <input type="radio" name="recipientmail" id="addr5" value="bklug75@yahoo.com"><label for="addr5">Women's Collection, Cookbook Collection, University Archives</label><br />
  107. <input type="radio" name="recipientmail" id="addr6" value="bklug75@gmail.com"><label for="addr6">WASP/Women's Airforce Service Pilots</label><br />
  108. <input type="radio" name="recipientmail" id="addr7" value="bklug@mail.twu.edu"><label for="addr7">Suggest a Purchase</label><br />
  109. <input type="radio" name="recipientmail" id="addr8" value="bklug75@yahoo.com"><label for="addr8">Personal Interest</label><br />
  110. <input type="radio" name="recipientmail" id="addr9" value="bklug75@yahoo.com"><label for="addr9">Other</label></td></tr>
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.      <tr>
  127.     <td height="62">
  128.  
  129. <b><span class="style3">*</span>Ask your brief question here<br /> (in 50-75 words or less): </b> <br /></td>
  130.     <td> <textarea name="requiredcomments" rows="9" cols="50" wrap="virtual"></textarea><br><br>                 
  131.  
  132.  
  133.  
  134.  
  135.  
  136.           <input type="submit" value="Submit request"  /></td>
  137.   </tr></table>
  138.    </form>
Jul 16 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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