2006-06-11 (日)
■ ActionForm の使い方メモ
ActionForm に値を格納するメソッドは以下の3種類。
- setApp()
- setAppNE()
- set()
それぞれテンプレート中では以下のように使われる。
| メソッド | テンプレートでの値の取得方法 | 値のエスケープ |
|---|---|---|
| setApp() | {$app.〜} | される |
| setAppNE() | {$app_ne.〜} | されない |
| set() | {$form.〜} | される |
さて、これらをどう使い分ければよいのか? 一言で言うと、単なる表示の場合は setApp()、 フォームの値の場合は set() という感じだと思うが、 いくつかの例を箇条書きにしてみる。
set() を使うケース
- フォームに初期値を設定する場合
フォーム画面でデータの編集をするような場合、 Validation に引っかかり再びその画面に戻ってくる場合を考えると、 テンプレートでは {$form.〜} として値を参照しなければならない。 よって、初期値を ActionForm に渡す際にも、 それに合わせて set() を使う。
setApp() を使うケース
- セレクトボックス用の配列を渡す場合
例えば、何月なのかを選んでもらうために、
$months = range(1, 12);
$this->af->setApp('months', $months);
のような配列をセットする場合。 フォームだから set() を使うのかと一瞬考えたりしたが、 値を表示するだけで書き換えるわけではないので、 setApp() を使うのが適切。
setAppNE() を使うケース
- HTML タグとして解釈したい文字列を含んでいる場合
例えば、Topic Path を表示するための HTML を PHP スクリプト中で組み立てておいて、 それをテンプレートに渡す場合とか。
このエントリの続き: 2006-06-13 (火)
[コメントを書く]
本日のリンク元
- 27 http://blogger.blog360.jp/552429/14272508
- 7 google検索(setApp)
- 6 google検索(setAppNE)
- 6 google検索(ethna setApp)
- 5 google検索(ActionForm 初期値 設定)
- 5 google検索(setAppNE)
- 3 google検索(ethna ActionForm コンストラクタ)
- 3 google検索(html action form)
- 3 http://pookmark.jp/user/fm315/ethna
- 2 google検索(html actionform set)
- 2 google検索(ethna setApp)
- 2 google検索(セレクトボックス 値の取得)
- 2 google検索(ActionForm ethna 配列)
- 2 google検索(ActionFormの使い方)
- 2 google検索(jQuery 配列 フォーム)
- 2 google検索(チェックボックス 連動 フォーム 無効)
- 2 google検索(ActionForm エスケープ)
- 2 google検索(Zend Framework ActionForm)
- 2 google検索(setappne)
- 2 google検索(javascript actionform)
- 2 google検索(actionform 初期値)
- 2 google検索(Ethna setApp)
- 2 google検索(Ethna ActionForm データベース)
- 2 google検索(ActionForm set)
- 2 google検索(ActionForm 初期値)
- 2 google検索(ActionForm 初期値)
- 2 google検索( javascript actionform)
- 2 google検索("piece framework")
- 2 google検索(pagetree 使い方)
- 2 google検索(setAppne)
- 2 google検索(ActionForm)
- 2 google検索(Ethna setAppNE 配列を設定)
- 2 google検索(setAppNe タグ )
- 2 google検索(setAppNe)
- 2 google検索(setAppNE)
- 2 google検索(setAppNE() 使い方)
- 2 google検索(setAppNE setApp)
- 2 google検索(php ActionForm)
- 2 google検索(javascript actionform)
- 2 google検索(ethna setapp)
- 2 google検索(ethna setApp)
- 2 google検索(ethna actionform)
- 2 google検索(ethna actionform メソッド 種類)
- 2 google検索(actionform set)
- 2 google検索(actionform 初期値)
- 2 google検索("actionformの使い方")
- 2 google検索(struts actionform 値の取得)
- 2 google検索(ajax ethna action form)
- 2 http://www.google.co.jp/hws/search?hl=ja&q=actionf...
- 2 http://www.google.co.jp/hws/search?hl=ja&q=Ethna A...
- 2 http://209.85.173.104/search?q=cache:vrTPADYewGUJ:...
- 1 google検索(setappne)
- 1 google検索(ActionForm 1.3)
- 1 google検索(ActionForm 初期値)
- 1 google検索(setappne)
- 1 google検索(ethna action form )
- 1 google検索(actionform set)
- 1 google検索(actionform 配列)
- 1 google検索(actionform 配列)
- 1 google検索(actionform 初期値)
- 1 google検索(actionform 値をsetする)
- 1 google検索(Ethna ActionForm)
- 1 google検索(Ethna フォームの値 テンプレート)
- 1 google検索(ActionForm javascript set)
- 1 google検索(ActionForm 配列)
- 1 google検索(ActionForm)
- 1 google検索(jquery フォーム チェック)
- 1 google検索(ethna actionform)
- 1 google検索(actionform html: セレクト 初期値)
- 1 google検索(actionform 配列 一覧表示)
- 1 google検索(actionform 配列 格納)
- 1 google検索(actionform 使い方)
- 1 google検索(actionformの使い方)
- 1 google検索(ActionForm php)
- 1 google検索(ActionForm 使い方)
- 1 google検索(ActionForm 例)
- 1 google検索(ethna フォーム エスケープ)
- 1 google検索(Ethna ActionForm 初期値 設定)
- 1 google検索(配列 ActionForm)
- 1 google検索(ethna actionform set)
- 1 google検索(Ethna ActionForm)
- 1 google検索(ethna 初期値設定)
- 1 google検索(actionForm 初期値)
- 1 google検索(actionform set)
- 1 google検索(ActionForm set)
- 1 google検索(jQuery フォーム)
- 1 google検索(zend framework form)
- 1 google検索(zend framework 初期値)
- 1 google検索(setappne)
- 1 google検索(setAppNE)
- 1 google検索(php static 初期値)
- 1 google検索(ethna set)
- 1 google検索(ethna actionform)
- 1 google検索(counterlist.inc.php)
- 1 google検索(actionform 配列)
- 1 google検索(Ethna ActionForm)
- 1 google検索(ActionForm)
- 1 google検索(setApp php)
- 1 google検索(ActionForm PHP)
- 1 google検索(jquery form 使い方)
