## **10. form:表單**
**參數**
| 參數名 | 類型 | 默認值 | 說明 |
| --- | --- | --- | --- |
| id | int | `必填` | 表單id |
**字段**
| 說明| 調用代碼 |
| --- | --- |
| 表單名稱 | `{$form.table.name}` |
| 表單ID | `{$form.table.id}` |
| 表單字段信息,是二維數組 | `{$form.field}` |
**示例**
```
{jidu:form id="8"}
<form name="myform" method="post" action="submit.html" onsubmit="return CheckJob();">
<input type="hidden" name="id" value="{$form.table.id}">
{volist name="$form.field" id="vo"}
<div>
<label>{$vo.name}:<input type="text" name="{$vo.field}"></label>
</div>
{/volist}
<!-- 判斷驗證是否開啟 -->
{eq name='$form.table.is_verify' value='1'}
<div>
<label>驗證碼:<input type="text" name="code"></label>
<div>
<img id="img" height="40" alt="驗證碼" src="{:captcha_src()}" title="點擊刷新">
</div>
</div>
<script>
var captcha_img = $("#img");
var verifyimg = captcha_img.attr("src");
captcha_img.on('click', function () {
captcha();
})
function captcha() {
if (verifyimg.indexOf('?') > 0) {
captcha_img.attr("src", verifyimg + '&random=' + Math.random());
} else {
captcha_img.attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
}
}
</script>
{/eq}
<div>
<div>
<button type="submit">提交留言</button>
<button type="reset" name="reset" >重新填寫</button>
</div>
</div>
</form>
{/jidu:form}
```
**說明**
**form.field** 為表單字段信息