标签:put ram inpu return value end option name 选择
html
<form id="myForm" >
<input id="cc" value="001" style="width: 50px;">
<select class="easyui-combobox" name="sex0" id="sex0" data-options="width:100,panelHeight:72,editable:false,required:true,validType:‘comboxRequired[\‘-- 请选择 --\‘]‘">
<option value="">-- 请选择 --</option>
<option value="男">男</option>
<option value="女">女</option>
</select>
<select class="easyui-combobox" name="sex1" id="sex1" data-options="width:100,panelHeight:72,editable:false,required:true">
<option value="男">男</option>
<option value="女">女</option>
</select>
<button type="button" id="formresetButton">reset<button>
<button type="button" id="formSubmitButton">submit<button>
</form>
js
//添加一个验证类型
$.extend($.fn.validatebox.defaults.rules, {
comboxRequired: {
validator: function(value, param){
return value!= param[0];
},
message: ‘必须选择一个‘
}
});
$(‘#formresetButton‘).on("click",function(){
$(‘#myForm‘).form("reset");
});
$(‘#formSubmitButton‘).on("click",function(){
$(‘#myForm‘).form("submit",{
onSubmit: function(){
var isValid = $(this).form(‘validate‘);
//如果验证失败,返回false,form不提交
console.log(isValid);
return isValid;
}
});
});
标签:put ram inpu return value end option name 选择
原文地址:http://www.cnblogs.com/huoxiansudi/p/6636717.html