Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Populating $form_input with 'select' element options? (HTML::FormFu)

by jbl_bomin (Sexton)
on Nov 04, 2011 at 17:54 UTC ( [id://935982]=perlquestion: print w/replies, xml ) Need Help??

jbl_bomin has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

Using HTML::FormFu, I'm trying to understand the data-structure required to populate a form with 'select' element values (options).

When I dump (Data::Dumper) the FormFu object, I see that the object structure looks similar to the following:

'name' => 'EmailDL', '_options' => [ { 'label_attributes' => {}, 'value' => 'm', 'container_attributes' => {}, 'label' => 'Male', 'attributes' => {} }, { 'label_attributes' => {}, 'value' => 'f', 'container_attributes' => {}, 'label' => 'Female', 'attributes' => {} } ],

Seeing this, I figured that the way to structure $form_input (being that $form_input = \%cgivars) would be something like the following:

'Firstname' => 'Faisal', 'EmailDL' => [ { 'value' => 'myvalue', 'label' => 'mylabel' } ],

However this doesn't seem to work. I've found that structuring $form_input correctly, and then issuing a $fu->default_values($form_input) to be simple and effective, except in this instance when I'm trying to include the select/options sub-structure.

So the question is: How should I structure 'EmailDL' above to correctly populate 'select' options when doing $fu->default_values($form_input) or $fu->process($form_input) ?

Any guidance on this would be appreciated, thanks!
-Bobby

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://935982]
Approved by Eliya
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-25 08:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found