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
- <head>
- <script>
- function formProcess(form1)
- {
- /* More than 1 elm with name, so a collection is returned */
- var elms = form.elements.recipientmail, selected;
- for(var k=-1, elm; elm=elms[++k];){
- if(elm.checked)
- selected = elm;
- }
- /* If selected remains undefined (ie no selection made) */
- if(!selected){
- alert("Please select department");
- return false;
- }
- /* Else set action; allow submit */
- form.action = "mailto:"+selected.value;
- return true;
- }
- // bklug@mail.twu.edu
- </script> <script>
- // JavaScript Document
- /* This script and many more are available free online at
- The JavaScript Source!! http://javascript.internet.com
- Created by: wsabstract.com | http://www.wsabstract.com */
- function checkrequired(which) {
- var pass=true;
- for (i=0;i<which.length;i++) {
- var tempobj=which.elements[i];
- if (tempobj.name.substring(0,8)=="required") {
- if (((tempobj.type=="text"||tempobj.type=="textarea")&&
- tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
- tempobj.selectedIndex==0)) {
- pass=false;
- break;
- }
- }
- }
- if (!pass) {
- shortFieldName=tempobj.name.substring(8,30).toUpperCase();
- alert("The "+shortFieldName+" field is a required field.");
- return false;
- } else {
- return true;
- }
- }</script>
- </head>
- <body>
- <h2>Ask a Librarian</h2>
- <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))">
- <input type=hidden name=sendername value="Automailer">
- <input type=hidden name=subject value="Distance Learning Request">
- <input type=hidden name=recipientname value="DL">
- <input type=hidden name=fromaddress value="webmaster@twu.edu">
- <input type=hidden name=redirect value=http://www.twu.edu/library/>
- <input type=hidden name=userinfo value="on">
- The more information you provide on this form, the better we can serve you.<br />
- <table width="928" border="0" bgcolor="#cccccc">
- <tr> <td height="30"><span class="style3">*Required Field</span>
- <span class="style3"></td>
- <td></td>
- </tr>
- <td height="30">
- <span class="style3">*</span><strong>Name:</strong></td>
- <td><br /><input type="text" name="requiredname" size="50" /><br><br></td>
- </tr>
- <tr>
- <td><b><span class="style3">*</span>Your Affiliation:</b></td>
- <td><br />
- <input type="radio" name="status" value="Student"> Student
- <input type="radio" name="status" value="Faculty"> Faculty
- <input type="radio" name="status" value="Staff"> Staff
- <input type="radio" name="status" value="Other"> Other<br /><br /></td>
- </tr>
- <tr>
- <td><b>FACULTY/STAFF ONLY: </b></td>
- <td>
- <b><br />Department </b>
- <input type="text" name="department" size="35"/>
- <b> Phone </b><input type="text" name="phone" size="35"/><br><br></td>
- </tr>
- <tr>
- <td><b><span class="style3">*</span>Email Address :</b> </td>
- <td><br /><br /> <input type="text" name="requiredemail" size="35"/><br>
- <i>Your email address MUST be accurate for us to deliver information to you.</i><br /><br /></td>
- </tr>
- <tr>
- <td height="62"><span class="style3">*</span><b>My question is about: </b></td>
- <td>
- <input type="radio" name="recipientmail" id="addr0" value="bklug75@gmail.com"><label for="addr0">Register for Library Services</label><br />
- <input type="radio" name="recipientmail" id="addr1" value="bklug@mail.twu.edu"><label for="addr1">Research Paper</label><br />
- <input type="radio" name="recipientmail" id="addr2" value="bklug75@yahoo.com"><label for="addr2">Classroom Assignment</label>
- <br />
- <input type="radio" name="recipientmail" id="addr3" value="bklug75@gmail.com"><label for="addr3">Reporting Connection Trouble
- to Databases</label><br />
- <input type="radio" name="recipientmail" id="addr4" value="bklug@mail.twu.edu"><label for="addr4">Distance Learning Services</label><br />
- <input type="radio" name="recipientmail" id="addr5" value="bklug75@yahoo.com"><label for="addr5">Women's Collection, Cookbook Collection, University Archives</label><br />
- <input type="radio" name="recipientmail" id="addr6" value="bklug75@gmail.com"><label for="addr6">WASP/Women's Airforce Service Pilots</label><br />
- <input type="radio" name="recipientmail" id="addr7" value="bklug@mail.twu.edu"><label for="addr7">Suggest a Purchase</label><br />
- <input type="radio" name="recipientmail" id="addr8" value="bklug75@yahoo.com"><label for="addr8">Personal Interest</label><br />
- <input type="radio" name="recipientmail" id="addr9" value="bklug75@yahoo.com"><label for="addr9">Other</label></td></tr>
- <tr>
- <td height="62">
- <b><span class="style3">*</span>Ask your brief question here<br /> (in 50-75 words or less): </b> <br /></td>
- <td> <textarea name="requiredcomments" rows="9" cols="50" wrap="virtual"></textarea><br><br>
- <input type="submit" value="Submit request" /></td>
- </tr></table>
- </form>