Alex Povolotsky wrote:
Hello!
I'm trying to make a form with select using Controller::FormBuilder.
Code is quite straightforward
=== edit.fb ===
name: server_edit
method: post
fields:
name:
label: Server Name
required: 1
type: text
size: 60
descr:
label: Description
type: textarea
rows: 4
cols: 60
ipid:
label: IP
type: select
required: 1
=== edit.fb ===
=== from Server.pm ===
sub edit : Local Form {
my ($self, $c, $lid, $sid) = @_;
if (!defined $lid) {
$c->response->redirect($c->uri_for('/location/list'));
$c->detach();
}
my $form = $self->formbuilder;
my $iplist = $c->model('OurIP')->search(undef,
{columns =>
[qw /ipid ipaddr/],
order_by => 'ipaddr'});
$c->log->info(join(', ', map { $_->ipid.' '.$_->ipaddr } $iplist->all));
$form->field(name=>'ipid',
type => 'select',
options =>
[ map { [ $_->ipid, $_->ipaddr] } $iplist->all ],
#other => 1,# create "Other:"
box );
# No processing yet
}
=== from Server.pm ===
Looks OK, doesn't it?
Debug shows
[CGI::FormBuilder::Field::select::tag] (debug2) ipid: generating select
input type
[CGI::FormBuilder::Field::tag_value] (debug2) ipid: called
$field->tag_value
[CGI::FormBuilder::Field::tag_value] (debug2) ipid: sticky && ! force
[CGI::FormBuilder::Field::cgi_value] (debug2) ipid: called
$field->cgi_value
[CGI::FormBuilder::Field::tag_value] (debug2) no cgi found, returning
def_value
[CGI::FormBuilder::Field::def_value] (debug2) ipid: called
$field->def_value
[CGI::FormBuilder::Field::def_value] (debug2) ipid: def value = ()
[CGI::FormBuilder::Field::inflate_value] (debug2) ipid: called
$field->inflate_value
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94cfd54))
= (,-select-,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b27fc))
= (1,88.212.221.66,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94335cc))
= (23,88.212.221.67,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2b68))
= (24,88.212.221.68,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2bb0))
= (26,88.212.221.69,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94a3eec))
= (31,88.212.221.71,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94a3f04))
= (28,88.212.221.72,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94a3fc4))
= (27,88.212.221.73,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2010))
= (30,88.212.221.74,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2070))
= (2,88.212.221.75,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2088))
= (29,88.212.221.76,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2100))
= (3,88.212.221.77,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b213c))
= (4,88.212.221.78,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94334f4))
= (5,88.212.221.79,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2160))
= (17,88.212.221.81,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b21b4))
= (6,88.212.221.82,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b22b0))
= (10,88.212.221.83,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b22e0))
= (11,88.212.221.84,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b22f8))
= (12,88.212.221.85,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b231c))
= (13,88.212.221.86,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b279c))
= (7,88.212.221.88,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2ab4))
= (8,88.212.221.89,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94a367c))
= (25,88.212.221.90,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b25a4))
= (21,88.212.221.92,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b25e0))
= (14,88.212.221.93,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2040))
= (16,88.212.221.94,)
[CGI::FormBuilder::Field::select::tag] (debug2) optval(ARRAY(0x94b2358))
= (9,88.212.221.95,)
[CGI::FormBuilder::Field::select::tag] (debug2) ipid: generated tag =
-select-
88.212.221.66
88.212.221.67
88.212.221.68
88.212.221.69
88.212.221.71
88.212.221.72
88.212.221.73
88.212.221.74
88.212.221.75
88.212.221.76
88.212.221.77
88.212.221.78
88.212.221.79
88.212.221.81
88.212.221.82
88.212.221.83
88.212.221.84
88.212.221.85
88.212.221.86
88.212.221.88