您现在的位置是:首页 >>LayuiLayui

layui下拉选择项

zhang2021-07-22 09:38:43【Layui】人已围观

简介:
下拉选择学员和下拉选择付款方式不同,下拉代码写法不一样。学员的是: <% set rs=conn.exec("select CID,TrueName from CxCms_Tab...


下拉选择学员和下拉选择付款方式不同,下拉代码写法不一样。

学员的是:
<%
set rs=conn.exec("select CID,TrueName from CxCms_TableContent4 where ContentStatus=1 order by AddTime desc","r1")
echo "<select name='CustomerID' lay-search='' lay-verify='required'>"
echo "<option value=''>下拉选择学员</option>" & vbcr
Do While Not rs.Eof
if not isnul(id) then
if CInt(id)=rs("CID") then
echo "<option value=""" &rs("CID")& """ selected>" &rs("TrueName")& "</option>" & vbcr
else
echo "<option value=""" &rs("CID")& """>" &rs("TrueName")& "</option>" & vbcr
end if
else
echo "<option value=""" &rs("CID")& """>" &rs("TrueName")& "</option>" & vbcr
end if
rs.MoveNext
Loop
rs.Close:Set rs = Nothing
echo "</select>"
%>

这里if CInt(id)=rs("CID") 都转化为数字,CInt里面需要是name值“CustomerID”,
但这里用的是id相等,所以用的是id

付款方式是:
<select name="PayItem" lay-verify="required">
<option value="">选择回款项目</option>
<%=GetSelect(replaceStr(sel_PayItem,"",""),"")%>
</select>
这里“sel_”里面的参数要和name对应。


例子:

<div class="layui-form-item">
<label class="layui-form-label">回款客户</label>
<div class="layui-input-inline">
<%
set rs=conn.exec("select CID,TrueName from CxCms_TableContent4 where ContentStatus=1 order by AddTime desc","r1")
echo "<select name='CustomerID' lay-search='' lay-verify='required'>"
echo "<option value=''>下拉选择学员</option>" & vbcr
Do While Not rs.Eof
if not isnul(id) then
if CInt(id)=rs("CID") then
echo "<option value=""" &rs("CID")& """ selected>" &rs("TrueName")& "</option>" & vbcr
else
echo "<option value=""" &rs("CID")& """>" &rs("TrueName")& "</option>" & vbcr
end if
else
echo "<option value=""" &rs("CID")& """>" &rs("TrueName")& "</option>" & vbcr
end if
rs.MoveNext
Loop
rs.Close:Set rs = Nothing
echo "</select>"
%>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">付款时间</label>
<div class="layui-input-inline">
<input type="text" name="PayTime" readonly value="<%=now()%>" lay-verify="required" placeholder="请输入付款时间" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">回款项目</label>
<div class="layui-input-inline">
<select name="PayItem" lay-verify="required">
<option value="">选择回款项目</option>
<%=GetSelect(replaceStr(sel_ItemType,"",""),"")%>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">付款方式</label>
<div class="layui-input-inline">
<select name="PayMent" lay-verify="required">
<option value="">选择付款方式</option>
<%=GetSelect(replaceStr(sel_PayMent,"",""),"")%>
</select>
</div>
</div>












文章评论

    评论加载中...

标签云

站点信息

  • 建站时间:2018-11-17
  • 文章统计:190篇文章
  • 微信交流:扫描二维码,添加我
在线客服
在线客服
在线咨询:
点击这里给我发消息技术交流
点击这里给我发消息技术交流
电话咨询:
(微信同步)
15629136039
微信二维码