国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
6.8KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  6. <title>自定义表单增加字段</title>
  7. <link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
  8. <link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="../static/web/css/admin.css">
  10. <script src="../static/web/js/jquery.min.js"></script>
  11. <script src="../static/web/js/bootstrap.bundle.min.js"></script>
  12. <script src="js/main.js"></script>
  13. <style>.nw{float:left;width:160px}.cls{clear:both}</style>
  14. <script>
  15. var notAllow = " <?php echo $f;?> ";
  16. function GetFields()
  17. {
  18. var theform = document.form1;
  19. var fieldname = theform.fieldname.value;
  20. var itemname = theform.itemname.value;
  21. var dtype = 'text';
  22. var enums = document.getElementsByName('dtype');
  23. for (i=0;i<enums.length;i++)
  24. {
  25. if (enums[i].checked) dtype = enums[i].value;
  26. }
  27. var isnull = theform.isnull.value;
  28. var vdefault = theform.vdefault.value;
  29. var maxlength = theform.maxlength.value;
  30. var vinnertext = theform.vinnertext.value;
  31. var spage = (theform.spage[0].checked ? theform.spage[0].value : theform.spage[1].value);
  32. var sisnull = (isnull==0 ? "false" : "true");
  33. if (itemname=="")
  34. {
  35. ShowMsg("表单提示名称不能为空");
  36. theform.itemname.focus();
  37. return false;
  38. }
  39. if (fieldname=="")
  40. {
  41. ShowMsg("字段名称不能为空");
  42. theform.fieldname.focus();
  43. return false;
  44. }
  45. if (notAllow.indexOf(" "+fieldname+" ") >-1 )
  46. {
  47. ShowMsg("字段名称不合法,如下字段名已经存在,建议在名称后加上数字以区分:\n"+notAllow);
  48. return false;
  49. }
  50. if ((dtype=="radio" || dtype=="select" || dtype=="checkbox") && vdefault=="")
  51. {
  52. ShowMsg("您选择的select或radio、checkbox类型,必须默认值设置选择的项目(用英文逗号)");
  53. return false;
  54. }
  55. if (spage=="no") spage = "";
  56. revalue = "<field:"+fieldname+" itemname=\""+itemname+"\" autofield=\"1\" type=\""+dtype+"\" isnull=\""+sisnull+"\" default=\""+vdefault+"\" ";
  57. revalue += " maxlength=\""+maxlength+"\" page=\""+spage+"\">"+vinnertext+"</field:"+fieldname+">";
  58. document.form1.fieldstring.value = revalue;
  59. return true;
  60. }
  61. </script>
  62. </head>
  63. <body>
  64. <table cellpadding="1" cellspacing="1" align="center" class="table maintable my-3">
  65. <form name="form1" action="diy_field_add.php" method="post" onSubmit="return GetFields();">
  66. <input type="hidden" name="action" value="save">
  67. <input type="hidden" name="diyid" value="<?php echo $diyid?>">
  68. <input type="hidden" name="fieldstring" value="">
  69. <tr>
  70. <td bgcolor="#f5f5f5" colspan="2">
  71. <table cellspacing="0" cellpadding="0" class="table table-borderless w-100">
  72. <tr>
  73. <td width="30%"><a href="diy_main.php">自定义表单管理</a> &gt; 增加新字段</td>
  74. <td width="70%" align="right"><button type="button" name="ss1" onClick="location='diy_edit.php?diyid=<?php echo $diyid;?>&dopost=edit';" class="btn btn-success btn-sm">当前表单信息</button></td>
  75. </tr>
  76. </table>
  77. </td>
  78. </tr>
  79. <tr>
  80. <td colspan="2">
  81. <div class="alert alert-danger mb-0">所有填写的文档不允许包含双引号[&quot;],否则配置无法写入</div>
  82. </td>
  83. </tr>
  84. <tr>
  85. <td width="30%">表单提示文字:发布文档时显示的提示文字</td>
  86. <td><input type="text" name="itemname" id="itemname"></td>
  87. </tr>
  88. <tr>
  89. <td>字段名称:只能用英文字母或数字,数据表的真实字段名,如果数据类型是联动类型,该项应该填写联动类型的<a href="stepselect_main.php" target="_blank">[组名称]</a></td>
  90. <td><input type="text" name="fieldname" id="fieldname"></td>
  91. </tr>
  92. <tr>
  93. <td>文档是否需要分页符:如果文档需要分页符,不论何种文档,都可以用#P#副标题#e#作为分页符号实现文档分页,但一个模型里仅允许一个这样的字段</td>
  94. <td>
  95. <input type="hidden" name="isnull" value="1">
  96. <label><input type="radio" name="spage" value="split"> 是</label>
  97. <label><input type="radio" name="spage" value="no" checked="1"> 否</label>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td>数据类型:</td>
  102. <td>
  103. <div class="nw"><label><input type="radio" name="dtype" id="dtype1" value="text" checked="1"> 单行文本(varchar)</label></div>
  104. <div class="nw"><label><input type="radio" name="dtype" id="dtype2" value="textchar"> 单行文本(char)</label></div>
  105. <div class="nw"><label><input type="radio" name="dtype" id="dtype3" value="multitext"> 多行文本</label></div>
  106. <div class="nw"><label><input type="radio" name="dtype" id="dtype4" value="htmltext"> 网页文本</label></div>
  107. <br class="cls">
  108. <div class="nw"><label><input type="radio" name="dtype" id="dtype6" value="int"> 整数类型</label></div>
  109. <div class="nw"><label><input type="radio" name="dtype" id="dtype7" value="float"> 小数类型</label></div>
  110. <div class="nw"><label><input type="radio" name="dtype" id="dtype8" value="datetime"> 时间类型</label></div>
  111. <div class="nw"><label><input type="radio" name="dtype" id="dtype13" value="select"> option下拉框</label></div>
  112. <br class="cls">
  113. <div class="nw"><label><input type="radio" name="dtype" id="dtype14" value="radio"> radio选项卡</label></div>
  114. <div class="nw"><label><input type="radio" name="dtype" id="dtype15" value="checkbox"> checkbox多选框</label></div>
  115. <div class="nw"><label><input type="radio" name="dtype" id="dtype9" value="img"> 图片</label></div>
  116. <div class="nw"><label><input type="radio" name="dtype" id="dtype12" value="addon"> 附件类型</label></div>
  117. </td>
  118. </tr>
  119. <tr>
  120. <td>默认值:如果定义数据类型为select、radio、checkbox时,此处填写被选择的项目(英文逗号分开,如“天涯,叙述”)</td>
  121. <td><textarea name="vdefault" id="vdefault" class="admin-textarea-xl"></textarea></td>
  122. </tr>
  123. <tr>
  124. <td>最大长度:文本数据必须填写,大于255为text类型</td>
  125. <td><input type="text" name="maxlength" id="maxlength" value="250" class="admin-input-xs"></td>
  126. </tr>
  127. <tr>
  128. <td>自定义网页表单:</td>
  129. <td>自定义网页表单模板中用~name~表示提示文字,~form~表示表单元素</td>
  130. </tr>
  131. <tr>
  132. <td></td>
  133. <td><textarea name="vinnertext" id="vinnertext" class="admin-textarea-xl"></textarea></td>
  134. </tr>
  135. <tr>
  136. <td bgcolor="#f5f5f5" colspan="2" align="center">
  137. <button type="submit" class="btn btn-success btn-sm">保存</button>
  138. <button type="reset" class="btn btn-outline-success btn-sm">重置</button>
  139. </td>
  140. </tr>
  141. </form>
  142. </table>
  143. </body>
  144. </html>