Struts1二级级联选择问题,一级不选不能选二级,提示
级联操作,若果不选择处罚类别,则无法选择处罚种类
//处罚种类
function refreshDataUnit(value) {
if("01" == value){
$("select[name='peanal']").prop("disabled",false);
$("select[name='peanal']").css("display","block");
$("select[name='administrative']").css("display","none");
$("select[name='partyDiscipline']").css("display","none");
$("select[name='inner']").css("display","none");
$("select[name='other']").css("display","none");
$("select[name='administrative']").val("");
$("select[name='partyDiscipline']").val("");
$("select[name='inner']").val("");
$("select[name='other']").val("");
$("select[name='peanal']").prop("disabled",false);
}else if("02" == value){
$("select[name='peanal']").css("display","none");
$("select[name='administrative']").css("display","block");
$("select[name='partyDiscipline']").css("display","none");
$("select[name='inner']").css("display","none");
$("select[name='other']").css("display","none");
$("select[name='peanal']").val("");
$("select[name='partyDiscipline']").val("");
$("select[name='inner']").val("");
$("select[name='other']").val("");
$("select[name='administrative']").css("display",false);
}else if("03" == value){
$("select[name='peanal']").css("display","none");
$("select[name='administrative']").css("display","none");
$("select[name='partyDiscipline']").css("display","block");
$("select[name='inner']").css("display","none");
$("select[name='other']").css("display","none");
$("select[name='peanal']").val("");
$("select[name='administrative']").val("");
$("select[name='inner']").val("");
$("select[name='other']").val("");
$("select[name='partyDiscipline']").css("display",false);
}else if("04" == value){
$("select[name='peanal']").css("display","none");
$("select[name='administrative']").css("display","none");
$("select[name='partyDiscipline']").css("display","none");
$("select[name='inner']").css("display","block");
$("select[name='other']").css("display","none");
$("select[name='peanal']").val("");
$("select[name='administrative']").val("");
$("select[name='partyDiscipline']").val("");
$("select[name='other']").val("");
$("select[name='inner']").css("display",false);
}else if("05" == value){
$("select[name='peanal']").css("display","none");
$("select[name='administrative']").css("display","none");
$("select[name='partyDiscipline']").css("display","none");
$("select[name='inner']").css("display","none");
$("select[name='other']").css("display","block");
$("select[name='peanal']").val("");
$("select[name='administrative']").val("");
$("select[name='partyDiscipline']").val("");
$("select[name='inner']").val("");
$("select[name='other']").css("display",false);
}
}
$(function(){
$("select[name='peanal']").prop("disabled","disabled");
$("select[name='administrative']").css("display","none");
$("select[name='partyDiscipline']").css("display","none");
$("select[name='inner']").css("display","none");
$("select[name='other']").css("display","none");
$("select[name='peanal']").prop("disabled",false);
});
HTML页面:
<tr>
<td>
处罚类别:
</td>
<td>
<html:select property="punishtype" styleClass="select_mid required" onchange="refreshDataUnit(this.value);">
<html:options collection="punishtypeMap" property="label" labelProperty="value" />
</html:select>
</td>
<td>
处罚种类:
</td>
<td>
<html:select property="peanal" styleClass="select_mid required">
<html:options collection="xingshiPunishMap" property="label" labelProperty="value" />
</html:select>
<html:select property="administrative" styleClass="select_mid required">
<html:options collection="xingzhenPunishMap" property="label" labelProperty="value" />
</html:select>
<html:select property="partyDiscipline" styleClass="select_mid required">
<html:options collection="dangjiPunishMap" property="label" labelProperty="value" />
</html:select>
<html:select property="inner" styleClass="select_mid required">
<html:options collection="neibuPunishMap" property="label" labelProperty="value" />
</html:select>
<html:select property="other" styleClass="select_mid required" onchange="onlyChange(this.value);">
<html:options collection="otherPunishMap" property="label" labelProperty="value" />
</html:select>
</td>
咋样判断不选择处罚类别,则无法选择处罚种类。若果先选择处罚种类则弹出提示框
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
jquery就可以判断啊
可以直接在界面上面进行判断,点击处罚种类的时候你可以进行判断,如果处罚类别没有选择这块应该给他return。