这是我的表单代码。
response.write("<form action='newRequest.asp' method='post' id='newRequest' data-ajax='false' name='newRequest'>")
'Three column table
response.write("<table border=0><tr>")
response.write("<td>")
response.write("Date received: <input type='text' name='dReceived' value='" & Date & "' Disabled>")
response.write("<input name='doRequest' type=hidden value='yes'/>")
response.write("</td>")
response.write("<td>")
response.write("Time received: <input type='text' name='tReceived' value='" & Time & "' disabled>")
response.write("</td>")
response.write("<td valign=middle align=center rowspan=2 class='tagBottom'>")
response.write("<div>Work Order No:")
response.write("<h1 class='workOrder'>" & wOrder & "</h1><div>")
response.write("<input type='hidden' value='" & wOrder & "' name='wOrder' class='tagNo'>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td>")
Set RS2 = Server.CreateObject("ADODB.RecordSet")
RS2.activeConnection = Conn
RS2.locktype = adLockOptimistic
RS2.cursorlocation = adUseClient
sql = "SELECT * "
sql = sql & "FROM tblEmployees "
sql = sql & "Order by EmployeeName"
RS2.Open sql
response.write("Received by:")
response.write("<select name='officerNum'>")
response.write("<option value='" & esUserID & "' selected>" & esUserID & "</option>")
Do While not RS2.EOF
response.write("<option value='" & titleCase(RS2("EmployeeId")) & "'>" & titleCase(RS2("EmployeeName")) & "</option>")
RS2.MoveNext
loop
RS2.Close
response.write("</select>")
response.write("</td>")
response.write("<td>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td>")
response.write("First Name: <input type='text' name='fName' id='fName'>")
response.write("</td>")
response.write("<td>")
response.write("Last Name: <input type='text' name='lName'>")
response.write("</td>")
response.write("<td>")
response.write("Home Phone: <input type='text' name='hPhone'>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td>")
response.write("Address: <input type='text' name='address' id='sAddress'>")
response.write("</td>")
response.write("<td align=center valign=middle class=button>")
response.write("<a href='#' onclick='openGoogle();' data-theme='e' type=button class='ui-btn-right'>Map It</a>")
response.write("</td>")
response.write("<td>")
response.write("Cell Phone: <input type='text' name='cPhone'>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td>")
Set RS3 = Server.CreateObject("ADODB.RecordSet")
RS3.activeConnection = Conn
RS3.locktype = adLockOptimistic
RS3.cursorlocation = adUseClient
sql = "SELECT DISTINCT CityID, CityNameZip "
sql = sql & "FROM tblCityList "
sql = sql & "Order by CityNameZip Asc"
RS3.Open sql
response.write("City:")
response.write("<select name='city' id='city'>")
response.write("<option value='NULL'>Select City</option>")
Do While not RS3.EOF
response.write("<option value='" & titleCase(RS3("CityID")) & "'>" & titleCase(RS3("CityNameZip")) & "</option>")
RS3.MoveNext
loop
RS3.Close
response.write("</select>")
response.write("</td>")
response.write("<td align=center valign=bottom>")
response.write("State:<h3>SC</h3><input type='hidden' value='SC' name='state'>")
response.write("</td>")
response.write("<td>")
response.write("Work Phone: <input type='text' name='wPhone'>")
response.write("</td>")
response.write("<tr>")
response.write("<td class=button colspan=3>")
response.write("<div data-role='controlgroup' data-type='horizontal' data-mini='false'>")
response.write("<a href='#' data-role='button' data-icon='grid' data-theme='e'>Kennel Card</a>")
response.write("<a href='#' data-role='button' data-icon='check' data-theme='e'>Turnaround and Print</a>")
response.write("<a href='#' data-role='button' data-icon='check' data-theme='e'>Animal in Trap</a>")
response.write("</div>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td colspan=3>")
response.write("<a href='newRequest.asp?action=Print' data-theme='e' type=button>Print</a>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td colspan=3>")
response.write("<hr>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td>")
Set RS4 = Server.CreateObject("ADODB.RecordSet")
RS4.activeConnection = Conn
RS4.locktype = adLockOptimistic
RS4.cursorlocation = adUseClient
sql = "SELECT * "
sql = sql & "FROM tblEmployees "
sql = sql & "Order by EmployeeName"
RS4.Open sql
response.write("Assigned To:")
response.write("<select name='assignedOfficer' id='assignedOfficer'>")
response.write("<option value='NULL' selected>Select Officer</option>")
Do While not RS4.EOF
response.write("<option value='" & titleCase(RS4("EmployeeId")) & "'>" & titleCase(RS4("EmployeeName")) & "</option>")
RS4.MoveNext
loop
RS4.Close
response.write("</select>")
response.write("</td>")
response.write("<td>")
response.write("</td>")
response.write("<td rowspan=4 valign=top class='textArea'>")
response.write("Additional Info:")
response.write("<textarea name='addInfo' class='addInfo'>Input any additional info here.</textarea>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td>")
Set RS5 = Server.CreateObject("ADODB.RecordSet")
RS5.activeConnection = Conn
RS5.locktype = adLockOptimistic
RS5.cursorlocation = adUseClient
sql = "SELECT * "
sql = sql & "FROM tblAnimalList "
sql = sql & "Order by AnimalTypeID"
RS5.Open sql
response.write("Animal Type:")
response.write("<select name='animalType' id='animalType'>")
response.write("<option value='NULL' selected>Select Animal</option>")
Do While not RS5.EOF
response.write("<option value='" & titleCase(RS5("AnimalTypeID")) & "'>" & titleCase(RS5("AnimalSpecies")) & "</option>")
RS5.MoveNext
loop
RS5.Close
response.write("</select>")
response.write("</td>")
response.write("<td align=center>")
response.write("Trap #<br>")
response.write("<input type='text' value='' name='trapNum'>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td>")
Set RS6 = Server.CreateObject("ADODB.RecordSet")
RS6.activeConnection = Conn
RS6.locktype = adLockOptimistic
RS6.cursorlocation = adUseClient
sql = "SELECT * "
sql = sql & "FROM tblAnimalStatus "
sql = sql & "Order by AnimalStatusID"
RS6.Open sql
response.write("Status:")
response.write("<select name='aStatus' id='aStatus'>")
response.write("<option value='' selected>Select Status</option>")
Do While not RS6.EOF
response.write("<option value='" & titleCase(RS6("AnimalStatusID")) & "'>" & titleCase(RS6("AnimalStatus")) & "</option>")
RS6.MoveNext
loop
RS6.Close
response.write("</select>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td colspan=2>")
Set RS7 = Server.CreateObject("ADODB.RecordSet")
RS7.activeConnection = Conn
RS7.locktype = adLockOptimistic
RS7.cursorlocation = adUseClient
sql = "SELECT * "
sql = sql & "FROM tblRequest "
sql = sql & "Order by RequestID"
RS7.Open sql
response.write("Services Requested:")
response.write("<select name='services' id='services'>")
response.write("<option value='' selected>Services Requested</option>")
Do While not RS7.EOF
response.write("<option value='" & titleCase(RS7("RequestID")) & "'>" & titleCase(RS7("ServiceRequested")) & "</option>")
RS7.MoveNext
loop
RS7.Close
response.write("</select>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td colspan=3>")
response.write("<hr>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td>")
response.write("<label for=slider2>Close Call</label><br>")
response.write("<select name='closeCall' id='closeCall' data-role='slider' onChange=""setDate(this.value);""><option value='False' selected>No</option><option value='True'>Yes</option>")
response.write("</td>")
response.write("<td colspan=2>")
response.write("<div class='block'><label>Date and Time Call Closed:</label><br><input type='text' value='' name='dtCloseCall' id='dtCloseCall' disabled/></div>")
response.write("<input type=hidden id=realCloseDate name=realCloseDate>")
response.write("</td>")
response.write("</tr>")
response.write("<tr>")
response.write("<td colspan=3>")
response.write("<textarea name='notes' class='addInfo' rows='10' cols='50'>Notes</textarea>")
response.write("</td>")
response.write("</tr>")
response.write("</table>")
'response.write("<input type='submit' class='sub-btn' id='subButton' data-transition='slide' name='Selection' value='Save'>")& vbcrlf
response.write("<div data-role='footer' data-position='fixed'>")
response.write("<h4>Florence County - Officer: " & esUserID & "</h4>")
response.write("<a href='newRequest.asp' data-theme='e' class='ui-btn-right' onclick=""checkToSave();document.getElementById('newRequest').submit();"">Save</a>")
response.write("</div>")
response.write("</div>")
response.write("</form>")
当我使用以下方法遍历表单元素时:
for each f in request.form()
response.write("<p>" & f & " = " & request.form(f) &"</p>")
next
它返回除“部分”选择对象以外的所有元素。例如,它返回“City”值,但不返回assignedOfficer,animalType,aStatus或services项。所有标准的Input和Textarea字段都可以正常工作。
我从调试代码中得到了这个:
doRequest = yes
state = stateName
realCloseDate =
wOrder = 22303
address = some address
officerNum = 42
lName = lastName
city = 1
fName = firstName
hPhone = 5555555555
cPhone = 5555555555
addInfo = Input any additional info here.
notes = Notes
wPhone = 5555555555
trapNum =
closeCall = False
任何帮助将不胜感激。
答案 0 :(得分:0)
我发现了这种行为的原因。在我对select标签数据的javascript验证中,如果workorder的关闭状态为false,则将select的值设置为0。当我这样做时,不知道我在想什么,除了数据库不接受空值而我给它一个值。不幸的是,将Select设置为0必须禁用对象而不是设置值。