Thank you for the hint. now I have another problem that my customized province and state drop down box can't get data from database. Also select box labels ( 'Province' or 'State' ) are dynamically changed. Can I archive that in my customized select box? below is my code:

use strict;
use warnings;

use base qw ( HTML::FormFu::Element::select );

sub new {
 my $self = shift->SUPER::new( @_ );

 my $c = $self->form->stash->{ context };
 my $countries
     = $c->model( 'GuestBook::Country' )->search(
     { 'me.lang' => $c->language },
     {   order_by => 'me.country_id, subcountries.sort_name',
         prefetch => 'subcountries'
     }
 );

 while ( my $country = $countries->next ) {
       my $subcountries = $country->subcountries;
#my $subcountry_types = $country->subcountries->first->subcountry_type; ( this is either label 'Province' or label 'State', it depends on the country I chose)

       $self->options( [ {}, map { {
           label => $_->name,
           value => $_->subcountry_id }
           } $subcountries->all ] );
 };
return $self;
}


Thanks for the help

Kewei

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to