1. 自定义表单字段

<form action="" enctype="multipart/form-data" method="post">
		<input type="hidden" name="action" value="post" />
		<input type="hidden" name="diyid" value="1" />
		<input type="hidden" name="do" value="2" />
            <table width="100%">
                <tr><td width=60%>

                    <table style="width:30%">
                        <tr><td class="hd-w100">* 联系人姓名:</td><td><input type="text" value="" name="name"   required></td></tr>
                        <tr><td class="hd-w100">* 手 机 号 码:</td><td><input type="text" value="" name="tel"  required></td></tr>
                        <tr><td class="hd-w100">电子邮箱:</td><td><input type="text" value="" name="email" ></td></tr>
						<tr><td class="hd-w100">* 留 言 内 容:</td><td><textarea   value="" name="content"  required ></textarea></td></tr>
                    </table>

                   

                    <table style="width:30%">
                        
                        <tr><td colspan="2">
						<input type='hidden' name='source' id='source' >
						<input type="hidden" name="time" value="" type="text"   />   
						<script language="javascript" type="text/javascript">
						Calendar.setup({
							inputField     :    "time",
							ifFormat       :    "%Y-%m-%d %H:%M",
							showsTime      :    true,
							timeFormat     :    "24"
						});
                     </script>
						<input type="hidden" name="dede_fields" value="name,text;tel,text;email,text;time,datetime;source,text;content,multitext" />
<input type="hidden" name="dede_fieldshash" value="01ddd1c35cee006c4a69e4c46cf8de6c" />
						<input type="submit"  /></td></tr>
                    </table></form>

2、另外,后台自定义表单的时间可能会是一串数字,修改方法如下,打开

\dede\templets\diy_list.htm

在42行:“else”下面一行加入:   

if($fielddata[1]=='datetime')
{$fields[$field] = GetDateTimeMk($fields[$field]); }

然后,为了让前台显示正常,我们也要在前台添加这句代码。

在后台的插件模板目录里面找到这个模板:list_diyform.htm

具体路径为:\dede\templets\plus\list_diyform.htm

打开编辑,在这两行下面加上那4行代码。

 其它附件</a>";

   }

if($fielddata[1]=='datetime')
{$fields[$field] = GetDateTimeMk($fields[$field]); }

以上方法就可以让织梦自定义表单的时间字段在前台和后台正常显示了。 

 

3、修改/你的网站后台(默认dede)/templets/diy_list.htm文件,全部代码如下:

$allowhtml = array('htmltext');下插入

		if($fields['ifcheck']==1){
			$fields['sta']='已审核';
		}elseif($fields['ifcheck'] == 2){
			$fields['sta']='<span style="color:green;">无效</span>';
		}else{
			$fields['sta']='<span style="color:red;">未审核</span>';
		}
		//$fields['sta'] = $fields['ifcheck'] == 1 ? '已审核' : '<span style="color:red;">未审核</span>';    
<label><input type="radio" name="action" value="invalid" class='np' />无效</label>

  

相关文章:

  • 2021-09-14
  • 2021-09-18
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2021-04-16
  • 2021-04-20
  • 2021-11-25
  • 2021-10-12
  • 2021-08-29
  • 2022-12-23
相关资源
相似解决方案