私はHTML::FormHandlerを使用しており、次のようにフォームを動的に構築しています。
my $form = HTML::FormHandler->new(
name => 'types',
field_list => [
parent_id => {
type => 'Select',
label => 'Parent',
required => 1,
options => [{value=>'test',label=>'test'}],
},
],
);
上記のように 1 つのオプションのみを渡すと、フォームに対してレンダリングされる出力が次のようになります。
<select name="parent_id" id="parent_id">
<option id="parent_id.0" value="test"> </option>
<option id="parent_id.1" value="test"> </option>
</select>
ただし、結果の出力は次のようになります。
<select name="parent_id" id="parent_id">
<option id="parent_id.0" value="test">test</option>
</select>
しかし、次のようなオプションをもう 1 つ追加すると、次のようになります。
options => [{value=>'test',label=>'test'},{value=>'test2',label=>'test2'}],
その後、出力は正しくレンダリングされ、次のようになります。
<select name="parent_id" id="parent_id">
<option id="parent_id.0" value="test">test</option>
<option id="parent_id.1" value="test2">test2</option>
</select>
これは さんの側のバグHTML::FormHandler
ですか、それとも私が見逃しているものがありますか? ありがとう!