<input id="c-materialcode" class="form-control" name="row[materialcode]" type="text" data-rule="required;remote(product/tuzhi/check)">
- 字段唯一性验证
public function check()
{
$params = $this->request->post('row/a');
$materialcode = $params['materialcode'];
$materialcode = Db::table('tt_product_machine')->where('materialcode',$materialcode)->find();
if($materialcode!=NULL){
return $this->error('编码已存在,重新输入!');
}else{
return $this->success('编码可用!');
}
}