[html-formfu] get_element problem

Dermot paikkos at googlemail.com
Fri Oct 31 13:02:26 GMT 2008


Hi,

I struggle with the get_element method and in the past have fallen
back on the get_all_elements method. Perhaps someone can spot where I
am going wrong. In the snippets below I always receive an "Can't call
method "options" on an undefined" value error

Is there something wrong with the snippet/yml file below?

Thanx,
Dp.


...
  else {
    my @types = keys %fileTypes;
    $c->log->debug("Types ",join ', ', @types);
    my $select = $form->get_elements( {name => 'filetypes'});
    $c->log->debug("Select is ", $select);
    $select->options(\@types);
    $c->stash->{template} = 'files/foo.tt2';
  }


---
auto_fieldset: 1
indicator: submit
elements:
#  Number
 - type: Text
   name: number
   label:  Number
   attributes:
     title: A number
     size: 10
     maxlength: 9
   filter:
    - TrimEdges
    - HTMLEscape
   constraints:
    - Required
# Type
 - type: Select
   name: filetypes
   label: The file type
   attributes:
     title: The file's type
   constraints:
    - Required
# The submit button
 - type: Submit
   name: submit
   value: Check



More information about the HTML-FormFu mailing list