create.php
2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
use yii\helpers\Url;
$this->title = '创建机器型号';
$this->params['breadcrumbs'][] = ['label' => '机器型号管理', 'url' => ['/model/model/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<form action="<?php echo Url::toRoute(['/model/model/do-add']); ?>" name="myFrom" id="myFrom" method="post" enctype="multipart/form-data">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-group col-sm-12" style="text-align: center">
<h3>创建机器型号</h3>
</div>
<div class="form-group col-sm-12">
<label for="skillName" class="col-sm-4 control-label text-right">机器型号:</label>
<div class="col-sm-4 text-left">
<input type="text" value="" name="name" placeholder="请输入机器型号" style="margin-top: -6px;" class="form-control"">
</div>
</div>
</div>
<div class="panel-footer text-center">
<button type="button" class="btn btn-primary ladda-button" data-style="slide-up" id="save">确 定</button>
<a class="btn btn-default" href="<?=Url::toRoute("/model/model/create")?>">重 置</a>
</div>
</div>
</form>
<script>
// 表单提交验证
seajs.use("base/1.0.0/unit/validate/custom-1.0.0",function () {
var validator = $("#myFrom").validate({
//debug:true,
rules: {
}
});
});
$("#save").bind("click", function () {
var getUrl = '<?=Url::toRoute("/model/model/do-add")?>';
$('#myFrom').attr('action', getUrl);
var a = $("input[name='name']").val();
if (a == ""){
alert("机器型号不能为空");
return false;
}
var cb = $("#myFrom").validate().form();
if (!cb){
return;
}
var submit = $('#myFrom').submit();
var l = $.ladda(this);
l.start();
return false;
});
</script>