$(document).ready(function () {
$("#myForm").bootstrapValidator({
message: 'This value is not valid',
FeedbackIcons: {
valid: 'glyphicon glyphicon-ok',invalid: 'glyphicon glyphicon-remove',validating: 'glyphicon glyphicon-refresh'
},fields: {
takeName: {
validators: {
notEmpty: {
message: '任务
名称不能为空'
}
}
},dllName: {
validators: {
notEmpty: {
message: '程序集
名称不能为空'
},//remote: {//ajax验证。server result:{"valid",true or false} 向服务发送当前input name值,获得一个json数据。例表示正确:{"valid",true}
// url: '/Task/Test3',//验证地址
// message: '
用户已存在',//
提示消息
// delay :3000,// type: 'POST',//请求方式
// /**
自定义提交数据,默认值提交当前input value
// * data: function(validator) {
// return {
// password: $('[name="passwordNameAttributeInYourForm"]').val(),// whatever: $('[name="whateverNameAttributeInYourForm"]').val()
// };
// }
// */
//},}
},methodName: {
validators: {
notEmpty: {
message: '类
名称不能为空'
}
}
},cron: {
validators: {
notEmpty: {
message: 'cron表达不能为空'
}
}
}
},submitHandler: function (validator,form,submitButton) {
var taskData = {};
taskData.taskName = $('#takeName').val();
taskData.dllPath = $('#dllName').val();
taskData.methodName = $('#methodName').val();
taskData.cronExpression = $('#cron').val();
taskData.remark = $('#cronRemark').val();
taskData.enabled = $('#enabled').is(':checked');
$.ajax({
type: "post",url: "/Task/AddTask",data:taskData,success: function (data) {
alert(data);
$('#myForm').data('bootstrapValidator').resetForm(true);
}
});
}
})
})