On 6 Feb 2007, at 18:21, Jonas Alves wrote:

Hi all,
I'm trying to do a Reaction form to do an advanced search.
This is what I have for now:

package MyApp::Model::Action::Search;
use Reaction::Class;
use Reaction::InterfaceModel::Action;

class Search is 'Reaction::InterfaceModel::Action', which {
  has title      => (isa => 'SimpleStr', is => 'rw');
  has state    => (isa => 'Str',  is => 'rw',
valid_value_names => sub { [qw/One Two Three/] },
                       valid_values      => sub { [qw/1 2 3/] },
name_to_value_map => sub { {qw/One 1 Two 2 Three 3/} }, value_to_name_map => sub { {qw/1 One 2 Two 3 Three/} },
                      );
  implements do_apply => sub {};
};


I'd just pass valid_values => sub { [ qw/One Two Three/ ] } and treat it as an enum until you get to do_apply - do_apply should return appropriate data, perhaps doing the search itself and returning the resultset. Then you can pass an on_apply_callback to the ActionForm that populates the ListView off the returned rs.

--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for Catalyst, DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for details. + Help us build a better perl ORM: http://dbix- class.shadowcatsystems.co.uk/ +



_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to