<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

Dedecms网站自定义表单必填项

时间:2020-12-14

设置dedecms自定义表单中的字段为必填项的方法:

首先我们要用一段php代码来判断验证必选项:
1、我们先在plus/diy.php 文件中的的第40行下加上一下代码

//增加必填字段判断
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

2、在加了自定义表单的dedecms模板里面加上 :

<input type="hidden" name="required" value="content,name,tel" />( value= 里面填写你对应的要必填的字段)

0
首页
案例
关于
联系