DEDECMS内置的联动类型被注释掉了,网上有解决联动类型的例子,但存在后台信息的是枚举,都是数字,于是自己便采取了比较取巧的方案,用js代替联动类型 最近用DEDECMS完成一个自定义表单,要用到地区的三级级联,地区肯定要使用option下拉框,如果让人一个个填肯定不行,DEDECMS内置的联动类型被注释掉了,网上有解决联动类型的例子,但存在后台信息的是枚举,都是数字,不方便查看,网上的解决方案都不怎么完全,尝试了一下没有成功,自己便采取了比较取巧的方案,用js代替联动类型
自定义表单的字段的类型都使用单行文本,设置完之后前台查看,并浏览器查看它的源文件。
例如:
复制代码代码如下:
<form action=\"/plus/diy.php\" 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 style=\"width:97%;\" cellpadding=\"0\" cellspacing=\"1\">
<tr>
<td align=\"right\" valign=\"top\">省份:</td>
<td><input type=\'text\' name=\'province\' id=\'province\' style=\'width:250px\' class=\'intxt\' value=\'\' />
</td>
</tr>
<tr>
<td align=\"right\" valign=\"top\">地级市:</td>
<td><input type=\'text\' name=\'city\' id=\'city\' style=\'width:250px\' class=\'intxt\' value=\'\' />
</td>
</tr>
<tr>
<td align=\"right\" valign=\"top\">市、县级市:</td>
<td><input type=\'text\' name=\'country\' id=\'country\' style=\'width:250px\' class=\'intxt\' value=\'\' />
</td>
</tr>
<input type=\"hidden\" name=\"dede_fields\" value=\"province,text;city,text;country,text\" />
<input type=\"hidden\" name=\"dede_fieldshash\" value=\"652e45ca2c11e03bbe75d9f5ab1726ba\" /></table>
<div align=\'center\' style=\'height:30px;padding-top:10px;\'>
<input type=\"submit\" name=\"submit\" value=\"提 交\" class=\'coolbg\' />
<input type=\"reset\" name=\"reset\" value=\"重 置\" class=\'coolbg\' />
</div>
</form>修改它的form表单,改成自己所需要的样式,并将province,city,country都改成select的类型,三级级联使用js完成
如:
复制代码代码如下:
<form action=\"/plus/diy.php\" 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\" />
<select id=\"s_province\" name=\"province\"><option value=\"省份\">省份</option></select>
<select id=\"s_city\" name=\"city\" style=\"margin-left:20px;\"><option value=\"地级市\">地级市</option></select>
<select id=\"s_county\" name=\"country\" style=\"margin-left:20px;\"><option value=\"市、县级市\">市、县级市</option></select>
<script type=\"text/javascript\" src=\"js/area.js\"></script>
<script type=\"text/javascript\">_init_area();</script>
<input type=\"hidden\" name=\"dede_fields\" value=\"province,text;city,text;country,text\" />
<input type=\"hidden\" name=\"dede_fieldshash\" value=\"652e45ca2c11e03bbe75d9f5ab1726ba\" /></table>
<div align=\'center\' style=\'height:30px;padding-top:10px;\'>
<input type=\"submit\" name=\"submit\" value=\"提 交\" class=\'coolbg\' />
<input type=\"reset\" name=\"reset\" value=\"重 置\" class=\'coolbg\' />
</div>
</form>
本站除原创内容,其余内容均收集自互联网,仅限用于学习和研究目的,本站不对其内容的合法性、可用性承担任何责任。本站禁止以任何形式发布或转载任何违法相关信息,若您发现请立即向站长举报;用户投稿一切资源内容不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
如有版权内容,其版权均归原作者所有,本站虽力求保存原有版权信息,但因众多资源经多次转载,已无法确定其真实来源,故敬请原作者谅解!为尊重作者劳动成果,请购买正版支持作者,谢谢!若您对「HULIKU.COM」所载资源作品版权归属存有异议,请发送邮箱:ihuliku@qq.com 进行处理。
本站资源文件大多存储至云盘,如您发现图片或链接失效,请联系站长或作者,我们将及时进行更新。资源都是经过站长或作者收集测试优化后进行发布分享。如若转载请在贵站文内以超链形式注明狐狸库文章出处,谢谢合作!












![WordPress子比主题美化教程合集[2023/04/17]-狐狸库](https://huliku.com/pic/2023032607024935.png)
![狐狸库自定义子比主题底部footer页脚美化(自适应)[06.26]更新-狐狸库](https://huliku.com/pic/2023062610013835.png)



















请登录后查看评论内容