I have a simple question. I'm sure its easy to everyone... but me. I can't get my drop down box to report the option that was chosen. Can anyone help? This code is generic, but the one that is actually being used is similar to this one. For some reason its not reporting the chosen option from the drop down box to the excel wb. Can anyone let me know what I'm missing? Thanking you in advance!
<SCRIPT LANGUAGE=JAVASCRIPT>
var currentDate = new Date();
var date1 = currentDate.getDate();
var mon = currentDate.getMonth()+1;
var year = currentDate.getYear();
var today = mon+"/"+date1+"/"+year;
var filePath = "Somefile.xlsx";
function setDate() {
f1.tDate.value=today;
}
function saveToExcel() {
var myApp = new ActiveXObject("Excel.Application");
myApp.visible = false;
var xlCellTypeLastCell = 11;
var myWorkbook = myApp.Workbooks.Open(filePath);
var myWorksheet = myWorkbook.Worksheets(1);
myWorksheet.Activate;
objRange = myWorksheet.UsedRange;
objRange.SpecialCells(xlCellTypeLastCell).Activate;
newRow = myApp.ActiveCell.Row + 1;
strNewCell = "A" + newRow;
myApp.Range(strNewCell).Activate;
myWorksheet.Cells(newRow,1).value = f1.tDate.value;
myWorksheet.Cells(newRow,2).value = f1.tAgent.value;
myWorksheet.Cells(newRow,3).value = f1.tIssid.value;
myWorksheet.Cells(newRow,4).value = f1.tLOB.value;
myWorksheet.Cells(newRow,5).value = f1.tResp.value;
myWorksheet.Cells(newRow,6).value = f1.tResp.value;
myWorksheet.Cells(newRow,7).value = f1.tTaken.value;
myWorksheet.Cells(newRow,8).value = f1.tAlred.value;
myWorksheet.Cells(newRow,9).value = f1.tAlred.value;
myWorksheet.Cells(newRow,10).value = f1.tUnab.value;
myWorksheet.Cells(newRow,11).value = f1.tNotes.value;
myWorkbook.Close(true);
myApp.Workbooks.Close;
myApp.Close;
alert('Data successfully saved');
}
</SCRIPT>
<BODY onLoad="setDate()">
<form name="f1" method="post">
<h1>Some title</h1><br />
<h3>Payment Entry Log</h3>
<hr>
<table cellpadding="5" width="475">
<tr>
<td class="tb_bor"align="left" ><b>Date of Call</b><br />
<input type=text name=tDate ></td>
<td class="tb_bor" ><b>Entered By:<br /></b>
<select name="tAgent" id="tAgent" style="80% !important;">
<option value="Agent 1" >Agent 1</option>
<option value="Agent 2" >Agent 2</option>
<option value="Agent 3" >Agent 3</option>
<option value="Agent 4" >Agent 4</option>
<option value="Agent 5" >Agent 5</option>
<option value="Agent 6" >Agent 6</option>
<option value="Agent 7" >Agent 7</option>
<option value="Agent 8" >Agent 8</option>
<option value="Agent 9" >Agent 9</option>
<option value="Agent 10" >Agent 10</option>
</select>
</td>
</tr>
<tr>
<td class="tb_bor" ><b>Subscriber ID:</b></td>
<td align="left" ><input type=text name="tIssid" ></td>
</tr>
<tr>
<td class="tb_bor" ><b>L.O.B:<br /><br /></b>
<td align="left" >
<input id="az" type="radio" value="1" name="tLOB" >AZ<br />
<input id="ca" type="radio" value="2" name="tLOB" >CA<br />
<input id="or" type="radio" value="3" name="tLOB" >OR<br /><hr></td>
</tr>
<tr>
<td width="" class="tb_bor" ><b>Positive Response:<br /><br /></b>
<td align="left" width="235" >
<input id="yes" type="radio" value="4" name="tResp" >Yes<br />
<input id="no" type="radio" value="5" name="tResp" >No <b><font color="red" size="2">(Indicate only if negative response)</font></b><br /><hr></td>
</tr>
<tr>
<td width="" class="tb_bor" ><b>Was a payment taken? <br /><br /></b>
<td align="left" >
<input id="yes" type="radio" value="6" name="tTaken" >Yes<br />
<input id="no" type="radio" value="7" name="tTaken" >No <br /><hr></td>
</tr>
<tr>
<td width="225" class="tb_bor" ><b>Was a payment already made?<br /> <font color="red" size="2">(Must be located in systems, i.e. ABS, CHKSEA, LEDINQ, etc...)</font></b><br /><br /> </b>
<td align="left" >
<input id="yes" type="radio" value="8" name="tAlred" >Yes<br />
<input id="no" type="radio" value="9" name="tAlred" >No <br /><hr></td>
</tr>
<tr>
<td width="225" class="tb_bor" align="right"><b>Could the member be reached?<br /> <font color="red" size="2">(Busy, no awnser , wrong number etc please indicate)</font></b><br /><br /> </b>
<td align="left" >
<input id="yes" type="radio" value="10" name="tUnab" >Yes<br />
<input id="no" type="radio" value="11" name="tUnab" >No <br /><hr></td>
</tr>
<tr>
<td class="tb_bor" colspan="3" align="left"><b>Notes:</b><br />
<textarea rows="6" cols="55" name="tNotes" ></textarea><br />
<font color="red" size="2">(If a payment was taken, please add notes that were entered in the account)</font></td>
</tr>
</table>
<hr>
<table>
<tr>
<td align="center" colspan="2">
<input type="reset" name="Reset" value="Clear" >
<input type="button" name=save value="Submit" onClick='saveToExcel();'>
</td>
</tr>
</table>
</form>
</BODY>