First, we have to use some php code to determine the verification code is mandatory
1. Locate the file plus, and then in line 40 plus / diy.php file plus the following code:
//增加必填字段判断
if($required!=''){
if(preg_match('/,/', $required))
{
$requireds = explode(',',$required);
foreach($requireds as $field){
if($$field==''){
showMsg('带*号的为必填内容,请正确填写', '-1');
exit();
}
}
}else{
if($required==''){
showMsg('带*号的为必填内容,请正确填写', '-1');
exit();
}
}
}
//end
We add the following code in a custom form of dedecms template:
<input type="hidden" name="required" value="content,name,tel" />