2021-03-27 留言表单
{eyou:guestbookform type='default'} <form method="POST" enctype="multipart/form-data" action="{$field.action}" onsubmit="return checkForm();"> <input id="attr_5" type="text" value="" name="{$field.attr_5}" placeholder="{$field.itemname_5}"> <textarea id="attr_6" cols="40" rows="3" name="{$field.attr_6}" placeholder="{$field.itemname_6}"></textarea> <select name="{$field.attr_7}" id="attr_7"> <option value="无">无</option> {eyou:volist name='$field.options' id='vo'} <!-- 下拉列表循环 start --> <option value="{$vo.value}">{$vo.value}</option> {/eyou:volist} <!-- 下拉列表循环 end --> </select> <input type="submit" value="提交"> {$field.hidden} <!-- 不可缺少的隐藏令牌验证 --> </form> <script type="text/javascript"> function checkForm() { if (document.getElementById('attr_5').value.length == 0) { alert('{$field.itemname_5}'); return false; } return true; } </script> {/eyou:guestbookform}
标签:
赞赏
发表评论