标题:求助,求救,二级级联下拉表成功,但无法取得value写记录
只看楼主
modi
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-12-12
结帖率:0
已结贴  问题点数:20 回复次数:1 
求助,求救,二级级联下拉表成功,但无法取得value写记录
大类表type 结构ID TYPE_NAME名 level=1为一级菜单
小类表class 结构ID CLASS_NAME名  FATHER父级即大类表对应 ID   
需要在选择了大类小类后,大类小类ID在提交表单时写入记录。现在无法获取到对应ID,

    If Request("Action")="Upload" Then
      做了人二级级联下拉表,提交表单后怎样拿到二级级联的VALUE呢?????????要写入数据库记录大类和小类
        Upload()-----------------在接到UPLOAD的action后执行写记录
        %>
<script language="javascript">location.href="MyFiles.asp?action=Main";</script>
<%
    End If
    Private Function Upload()

…………………………

级联下拉表代码及表单如下:

<form action="?action=Upload" method="post" enctype="multipart/form-data" id="UpLoad_Form" Name="UpLoad_Form">
            <%
            dim count

  
      set   rs=server.createobject("adodb.recordset")  
      citysql="select * from class order by id asc"  
      rs.Open citysql,Conn,1,1  



            %>
<script language="javascript">
            var onecount;
            onecount=0;
            subcat=new Array();
  
  <%   
     count=0
     do while not rs.eof
     %>
     subcat[<%=count%>]=new Array('<%=rs("class_name")%>','<%=rs("father")%>','<%=rs("id")%>')
     <%      
  count=count+1
  rs.movenext
  loop
  rs.close
  %>
  onecount=<%=count%>;
function changeInput(inputv)
{
    var input=inputv;
    }
 function changelocation(locationid)
    {
        
   document.UpLoad_Form.proid.length = 0;
    var locationid=locationid;
  var i;
   
    for (i=0;i < onecount; i++)
        {
           if (subcat[i][1]==locationid)
            {
            document.UpLoad_Form.proid.options[document.UpLoad_Form.proid.length] = new Option(subcat[i][0], subcat[i][2]);
            }
   
                  
        }
        
    }  
  
  
 
  </script>
<form action="?action=Upload" method="post" enctype="multipart/form-data" id="UpLoad_Form" Name="UpLoad_Form">
  
                        
                        <%
                        dim rs,provincesql
                        Set rs = Server.CreateObject("ADODB.Recordset")   
                            provincesql ="SELECT * From type where level=1 Order By id asc"
    rs.open provincesql,Conn,1,1
                        %>
                          <select name="typeid" id="typeid"  onChange="changelocation(document.UpLoad_Form.typeid.options[document.UpLoad_Form.typeid.selectedIndex].value)">
                            <option   value="<%=rs("id")%>"><%=rs("type_name")%></option>
                            <%   
                           
                            dim selclass
                            selclass=rs("id")
                           
                            rs.movenext
            
                        

do while not rs.eof
%>
<option value=<%=rs("id")%>> <%=rs("type_name")%></option>>
<%
rs.movenext
loop
rs.close
%>
</select>
<select name="proid" id="proid" onChange="changeInput(document.UpLoad_Form.proid.options[document.UpLoad_Form.proid.selectedIndex].value)">
<%

rs.open "select * from class where father="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then

%>




<option value="<%=rs("id")%>"><%=rs("class_name")%></option>
<%
dim stypeid
stypeid=rs("id")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("id")%>"><%=rs("class_name")%></option>
<%
rs.movenext
loop

end if

rs.close
set rs=nothing

%>

</select>
搜索更多相关主题的帖子: 记录 Request action 
2012-12-12 19:57
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:20 
二级跟一级一样啊?你要给到服务器就需要提交表单,而且你这个代码
enctype="multipart/form-data"
这个表示表单还要用来上传文件,如果是这样的表单不能用Request来接收了,要用上传类提供的函数或方法。

2012-12-17 13:35



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-390939-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018978 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved