dedecms 自定义字段 默认值

在使用dedecms定义表单或者是模型中自定义字段时,无法使用php方法获取到默认值,在这里我们采用了js脚本来填充自定义字段的默认值。

假设有自定义字段:

<field:userid itemname="会员id" autofield="1" notsend="0" type="text" isnull="true" islist="0" default="" maxlength="250" page=""></field:userid>

那么在htm模板中使用js来填充

<script>
document.getElementById("userid").value=<?php echo $userid ?>
</script>

支持:潍坊人才网 http://www.jobyuandu.com

原文地址:https://www.cnblogs.com/coxsoft/p/2639841.html