本文簡要介紹ruby語言中 CGI::HtmlExtension.form
的用法。
用法
form(method = "post", action = script_name, enctype = "application/x-www-form-urlencoded") { || ... }
將 Form 元素生成為字符串。
method
應該是 “get” 或 “post”,默認為後者。 action
默認為當前的 CGI
腳本名稱。 enctype
默認為“應用程序/x-www-form-urlencoded”。
或者,可以將屬性指定為散列。
有關包含文件上傳的表單,另請參閱 multipart_form()
。
form{ "string" }
# <FORM METHOD="post" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
form("get") { "string" }
# <FORM METHOD="get" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
form("get", "url") { "string" }
# <FORM METHOD="get" ACTION="url" ENCTYPE="application/x-www-form-urlencoded">string</FORM>
form("METHOD" => "post", "ENCTYPE" => "enctype") { "string" }
# <FORM METHOD="post" ENCTYPE="enctype">string</FORM>
調用超類方法
相關用法
- Ruby HtmlExtension.file_field用法及代碼示例
- Ruby HtmlExtension.multipart_form用法及代碼示例
- Ruby HtmlExtension.textarea用法及代碼示例
- Ruby HtmlExtension.reset用法及代碼示例
- Ruby HtmlExtension.radio_group用法及代碼示例
- Ruby HtmlExtension.password_field用法及代碼示例
- Ruby HtmlExtension.image_button用法及代碼示例
- Ruby HtmlExtension.popup_menu用法及代碼示例
- Ruby HtmlExtension.submit用法及代碼示例
- Ruby HtmlExtension.checkbox用法及代碼示例
- Ruby HtmlExtension.checkbox_group用法及代碼示例
- Ruby HtmlExtension.html用法及代碼示例
- Ruby HtmlExtension.radio_button用法及代碼示例
- Ruby HtmlExtension.text_field用法及代碼示例
- Ruby HtmlExtension.caption用法及代碼示例
- Ruby HtmlExtension.img用法及代碼示例
- Ruby HtmlExtension.blockquote用法及代碼示例
- Ruby HtmlExtension.base用法及代碼示例
- Ruby HtmlExtension.hidden用法及代碼示例
- Ruby HtmlExtension.a用法及代碼示例
- Ruby HtmlExtension模塊用法及代碼示例
- Ruby Hash.reject用法及代碼示例
- Ruby Hash shift()用法及代碼示例
- Ruby HTTPResponse類用法及代碼示例
- Ruby Hash.delete()用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 HtmlExtension.form。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。