Webアプリケーションフレームワーク Ethna の git向けリポジトリ
Revisión | c5aaf53dd26bc23367dbee5328da3c82b6d61b37 (tree) |
---|---|
Tiempo | 2009-05-01 04:33:41 |
Autor | mumumu-org <mumumu-org@2ef8...> |
Commiter | mumumu-org |
- removed max form-def and maxlength on formhelper linkage.
@@ -21,6 +21,8 @@ | ||
21 | 21 | --- この機能はデフォルトで有効になっている。無効にしたければ、[appid]_ViewClass.php の $use_layout を false にする |
22 | 22 | -- フォームヘルパのテキストエリアに value 属性を付加していた動きを修正。(thanks: syachi5150) |
23 | 23 | --- http://sourceforge.jp/ticket/browse.php?group_id=1343&tid=16326 |
24 | +- [Breaking B.C] ルールがユーザにとって直感的ではないとの理由から、フォーム定義の max と フォームヘルパの maxlength の連携機能を削除 (thanks: syachi5150) | |
25 | +-- https://sourceforge.jp/ticket/browse.php?group_id=1343&tid=16325 | |
24 | 26 | |
25 | 27 | *** bug fix |
26 | 28 |
@@ -857,10 +857,8 @@ class Ethna_ViewClass | ||
857 | 857 | $params['value'] = $value; |
858 | 858 | } |
859 | 859 | |
860 | - // maxlength | |
861 | - if (isset($def['max']) && $def['max']) { | |
862 | - $params['maxlength'] = $def['max']; | |
863 | - } | |
860 | + // maxlength と フォーム定義のmax連携はサポートしない | |
861 | + // @see http://sourceforge.jp/ticket/browse.php?group_id=1343&tid=16325 | |
864 | 862 | |
865 | 863 | return $this->_getFormInput_Html('input', $params); |
866 | 864 | } |
@@ -1100,10 +1098,8 @@ class Ethna_ViewClass | ||
1100 | 1098 | $params['value'] = $value; |
1101 | 1099 | } |
1102 | 1100 | |
1103 | - // maxlength | |
1104 | - if (isset($def['max']) && $def['max']) { | |
1105 | - $params['maxlength'] = $def['max']; | |
1106 | - } | |
1101 | + // maxlength と フォーム定義のmax連携はサポートしない | |
1102 | + // @see http://sourceforge.jp/ticket/browse.php?group_id=1343&tid=16325 | |
1107 | 1103 | |
1108 | 1104 | return $this->_getFormInput_Html('input', $params); |
1109 | 1105 | } |
@@ -1,6 +1,6 @@ | ||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Ethna_View_FormHelper_Test.php | |
3 | + * Ethna_ViewClass_FormHelper_Test.php | |
4 | 4 | * |
5 | 5 | * @package Ethna |
6 | 6 | * @author Yoshinari Takaoka <takaoka@beatcraft.com> |
@@ -16,7 +16,7 @@ require_once ETHNA_INSTALL_BASE . '/test/Ethna_MockProject.php'; | ||
16 | 16 | * @author Yoshinari Takaoka <takaoka@beatcraft.com> |
17 | 17 | * @access public |
18 | 18 | */ |
19 | -class Ethna_View_FormHelper_Test extends Ethna_UnitTestBase | |
19 | +class Ethna_ViewClass_FormHelper_Test extends Ethna_UnitTestBase | |
20 | 20 | { |
21 | 21 | var $project; |
22 | 22 |
@@ -32,6 +32,34 @@ class Ethna_View_FormHelper_Test extends Ethna_UnitTestBase | ||
32 | 32 | unset($GLOBALS['_Ethna_controller']); |
33 | 33 | } |
34 | 34 | |
35 | + function test_formhelper_Text() | |
36 | + { | |
37 | + $action_name = $tpl_name = 'texttest'; | |
38 | + $action_skel = ETHNA_TEST_SKELDIR . 'skel.action.formhelper.php'; | |
39 | + $this->project->runCmd('add-action', | |
40 | + array( | |
41 | + '-s', | |
42 | + $action_skel, | |
43 | + $action_name, | |
44 | + ) | |
45 | + ); | |
46 | + $tpl_skel = ETHNA_TEST_SKELTPLDIR . 'skel.template.text.tpl'; | |
47 | + $this->project->runCmd('add-template', | |
48 | + array( | |
49 | + '-s', | |
50 | + $tpl_skel, | |
51 | + $tpl_name, | |
52 | + ) | |
53 | + ); | |
54 | + $submit_value = array( | |
55 | + 'text_setactval' => 'abcd', | |
56 | + ); | |
57 | + $result = $this->project->runMain($action_name, $submit_value); | |
58 | + $this->assertPattern('#<input type="text" name="text_noval" value="" />#', $result); | |
59 | + $this->assertPattern('#<input type="text" name="text_setactval" value="abcd" />#', $result); | |
60 | + $this->assertPattern('#<input value="1234" type="text" name="text_settplval" />#', $result); | |
61 | + } | |
62 | + | |
35 | 63 | function test_formhelper_Textarea() |
36 | 64 | { |
37 | 65 | $action_name = $tpl_name = 'textareatest'; |
@@ -21,6 +21,27 @@ class {$action_form} extends {$project_id}_ActionForm | ||
21 | 21 | * @var array form definition. |
22 | 22 | */ |
23 | 23 | var $form = array( |
24 | + | |
25 | + /** FORM_TYPE_TEXT のテスト */ | |
26 | + | |
27 | + 'text_noval' => array( | |
28 | + 'type' => VAR_TYPE_INT, | |
29 | + 'name' => 'textarea_noval', | |
30 | + 'form_type' => FORM_TYPE_TEXT, | |
31 | + ), | |
32 | + 'text_setactval' => array( | |
33 | + 'type' => VAR_TYPE_STRING, | |
34 | + 'name' => 'text_setval', | |
35 | + 'form_type' => FORM_TYPE_TEXT, | |
36 | + 'max' => 10, // maxlength は無視されなければならない | |
37 | + ), | |
38 | + 'text_settplval' => array( | |
39 | + 'type' => VAR_TYPE_STRING, | |
40 | + 'name' => 'text_settplval', | |
41 | + 'form_type' => FORM_TYPE_TEXT, | |
42 | + 'max' => 10, // maxlength は無視されなければならない | |
43 | + ), | |
44 | + | |
24 | 45 | /** FORM_TYPE_TEXTAREA のテスト */ |
25 | 46 | |
26 | 47 | // テンプレートでvalue属性を設定しない場合 |
@@ -0,0 +1,3 @@ | ||
1 | +{form_input name="text_noval"} | |
2 | +{form_input name="text_setactval"} | |
3 | +{form_input name="text_settplval" value="1234"} |