• 织梦简单的自定义表单字段


    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="30%">
                            <tr><td class="hd-w100">* 联系人姓名:</td><td><input type="text" value="" name="name" id="name" pattern="^[u4e00-u9fa5]{1,4}$"  required></td></tr>
                            <tr><td class="hd-w100">* 手 机 号 码:</td><td><input type="text" value="" name="tel" id="tel" pattern="^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])d{8}$" required></td></tr>
                            <tr><td class="hd-w100">电子邮箱:</td><td><input type="text" value="" name="email" id="email"></td></tr>
    						<tr><td class="hd-w100">* 留 言 内 容:</td><td><textarea   value="" name="content" id="content" pattern="^[u4e00-u9fa5]{1,54}$" required ></textarea></td></tr>
                        </table>
    
                       
    
                        <table style="30%">
                            
                            <tr><td colspan="2">
    						<input type='hidden' name='source' id='source' >
    						<input type="hidden" name="time" value="" type="text" id="time" style="250px" class="intxt"  />   
    						<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" id="" style="100px;height:40px; float:right;" name="Submit" value="确认提交" class="buttonface2" /></td></tr>
                        </table></form>
    

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

    dede empletsdiy_list.htm

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

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

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

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

    具体路径为:dede empletspluslist_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>
    

      

  • 相关阅读:
    【zookeeper】
    关于redis-windows环境下的一些配置:
    mybatis-注解开发
    jQuery的Validate插件
    Thymeleaf 学习笔记-实例demo(中文教程)
    thymeleaf 学习笔记-基础篇(中文教程)
    AGC 043C
    JOISC 2020 部分题解
    Loj #2687
    CF 1270I
  • 原文地址:https://www.cnblogs.com/qinglin/p/7146077.html
Copyright © 2020-2023  润新知