On 10/08/07, Tobias Kremer <[EMAIL PROTECTED]> wrote: > Quoting Thorsten Domsch <[EMAIL PROTECTED]>: > > name.setfromsqlstring would be cool or a method to change the value of a > > single selectbox like name.day.value or both(which would be best) > > Hmm.. I think it would be useful if one could stuff in a DateTime object > because > IMHO that's what most users are dealing with if they're using DBIC and > inflate_column.
To set the value of an individual select menu, use either of: $date->day->{default} = $day $date->month->{default} = $month $date->year->{default} = $year To set a default value for the entire date, you can now use: $date->default( $value ) $date->default() accepts either a DateTime object, or a date string matching the format of $date->strftime(). So that could be either of these: $date->default( DateTime->now ) $date->default( '14-08-2007' ) > The date element should also return a DateTime object by > default. This, together with DBIx::Class::FormFu will make it way easier to > deal with dates. I don't want to assume that most users are using DBIC, and don't think auto_inflate(1) should be the default behaviour - too much magic! However, there is a simple way to make it _your_ default behaviour... I recommend you make it a habit to have a site-wide config file, which you include from every form. So for example, your form config might look like this: --- load_config_file: 'root/forms/myapp.yml' elements: - etc, etc, etc Then in your site-wide config, you can set any defaults that you wish. For example, to make all date elements always have auto_inflate(1), your site wide config would look like this: --- element_defaults: date: auto_inflate: 1 Hope this helps, Carl _______________________________________________ HTML-FormFu mailing list HTML-FormFu@lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu