Click to See Complete Forum and Search --> : drop down list error


leeny
02-22-2005, 03:57 AM
when the user selects a property, upon the onChange event the unit of that particular property is shown. all this works but i'm facing a proble whereby when the user points towards the first option which happens to be "SELECT ONE", the following erroe msg appears

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/NZ/pbt.asp, line 780

how can i avoid this? please assist me. thanks in advance


<%
Else
sql= "Select Item,Unit from PBT where item = '" &i& "'"
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.open sql,conn
%>

<div align="center">
<table width="963" border="1" cellspacing="1" cellpadding="4">
<tr>
<td colspan="5"><div align="center"><strong> Material Selection Guide</strong></div></td>
</tr>
<tr>
<td colspan="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Enter
Value Here</td>
</tr>
<tr>
<td width="229"><div align="right">Please choose an item property:</div></td>
<td width="193">&nbsp; <select name="item" id="item" onChange="return item_onchange(form1)" language=javascript>
<option value = "0" selected>Select one</option>
<%if(request.form("item")="Density") then%>
<option value = "Density" selected>Density</option>
<%else%>
<option value = "Density">Density</option>
<%end if%>
<%if(request.form("item")="Moisture Absorptance") then%>
<option value = "Moisture Absorptance" selected>Moisture Absorptance</option>
<%else%>
<option value = "Moisture Absorptance">Moisture Absorptance</option>
<%end if%>
<%if(request.form("item")="Shrinkage Ratio") then%>
<option value = "Shrinkage Ratio" selected>Shrinkage Ratio</option>
<%else%>
<option value = "Shrinkage Ratio">Shrinkage Ratio</option>
<%end if%>
<%if(request.form("item")="Tensile Strength") then%>
<option value = "Tensile Strength" selected>Tensile Strength</option>
<%Else%>
<option value = "Tensile Strength">Tensile Strength</option>
<%End if%>
<%if(request.form("item")="Tensile Modulus") then%>
<option value = "Tensile Modulus" selected>Tensile Modulus</option>
<%Else%>
<option value = "Tensile Modulus">Tensile Modulus</option>
<%End if%>
<%if(request.form("item")="Flexural Strength") then%>
<option value = "Flexural Strength" selected>Flexural Strength</option>
<%Else%>
<option value = "Flexural Strength">Flexural Strength</option>
<%End if%>
<%if(request.form("item")="Flexural Modulus") then%>
<option value = "Flexural Modulus" selected>Flexural Modulus</option>
<%Else%>
<option value = "Flexural Modulus">Flexural Modulus</option>
<%End if%>
<%if(request.form("item")="Charpy Impact Unnotched") then%>
<option value = "Charpy Impact Unnotched" selected>Charpy Impact Unnotched</option>
<%Else%>
<option value = "Charpy Impact Unnotched">Charpy Impact Unnotched</option>
<%End if%>
<%if(request.form("item")="Charpy Impact Notched") then%>
<option value = "Charpy Impact Notched" selected>Charpy Impact Notched</option>
<%Else%>
<option value = "Charpy Impact Notched">Charpy Impact Notched</option>
<%End if%>
<%if(request.form("item")="HDT ( 0.46Mpa )") then%>
<option value = "HDT ( 0.46Mpa )" selected>HDT ( 0.46Mpa )</option>
<%Else%>
<option value = "HDT ( 0.46Mpa )">HDT ( 0.46Mpa )</option>
<%End if%>
<%if(request.form("item")="HDT ( 1.82Mpa )") then%>
<option value = "HDT ( 1.82Mpa )" selected>HDT ( 1.82Mpa )</option>
<%Else%>
<option value = "HDT ( 1.82Mpa )">HDT ( 1.82Mpa )</option>
<%End if%>
<%if(request.form("item")="Flammability") then%>
<option value = "Flammability" selected>Flammability</option>
<%Else%>
<option value = "Flammability">Flammability</option>
<%End if%>
<%if(request.form("item")="Dielectric Constant") then%>
<option value = "Dielectric Constant" selected>Dielectric Constant</option>
<%Else%>
<option value = "Dielectric Constant">Dielectric Constant</option>
<%End if%>
<%if(request.form("item")="Dielectric Loss Tangent") then%>
<option value = "Dielectric Loss Tangent" selected>Dielectric Loss
Tangent</option>
<%Else%>
<option value = "Dielectric Loss Tangent">Dielectric Loss Tangent</option>
<%End if%>
<%if(request.form("item")="Volume Resistivity") then%>
<option value = "Volume Resistivity" selected>Volume Resistivity</option>
<%Else%>
<option value = "Volume Resistivity">Volume Resistivity</option>
<%End if%>
<%if(request.form("item")="Dielectric Strength") then%>
<option value = "Dielectric Strength" selected>Dielectric Strength</option>
<%Else%>
<option value = "Dielectric Strength">Dielectric Strength</option>
<%End if%>
</select></td>
<td width="146">&nbsp; <input type="radio" name="exp" value="smaller or equals to">
&le;&nbsp;&nbsp; <input type="radio" name="exp" value="greater or equals to">
&ge;&nbsp;&nbsp; <input type="radio" name="exp" value="equals to">
= </td>
<td width="152"><div align="center"><input name="value" type="text" id="value"></div>
</td>
<td width="193">&nbsp;
<%
if not request.form("item")="" then
val=rs("unit")
else
val=""
end if
%>
<input name="unit" type="text" id="unit" readOnly="" value=<%=val%>>
(unit) </td>
</tr>
<tr>
<td colspan="5"> <div align="center">
<input type="submit" name="Submit" value="Submit" onClick = "return Valid()">
</div></td>
</tr>

buntine
02-22-2005, 07:00 AM
Several ways.

- From the server, use an if statement to check whether the variable equals "Select One" and then passback the data and display an error message.

- Remove "Select One". Most users will be quite sure that thats what the select box is there for

- Use JavaScript to disable the submit button until an option is selected. Or give an error on submit if "select One" is selected.

- If the user did not choose one, use a default option that may be applicable to the standard user.

Regards.