I copied the _form.php template out of the cache, and added
var_dump($form['end_time']->getValue());
which yields:
NULL
the other fields print correctly:
var_dump($form['end_ts']->getValue());
prints
string(19) "2008-12-05 01:00:00"
which leads me to think that the issue has something to do with the
value of the form getting set originally.
On Oct 23, 11:25 am, ashton <[email protected]> wrote:
> Rather, that does die when the form is submitted.
>
> On Oct 23, 9:31 am, ashton <[email protected]> wrote:
>
>
>
> > That will die when the form is submitted. Unfortunately, that's not
> > the issue that I'm having, what I'm seeing is that when going to the
> > edit page initially, getEndTime never gets called, and my end_time
> > widget doesn't get any values. Before I submit the form, just loading
> > the page.
>
> > On Oct 23, 9:12 am, Alexandre SALOME <[email protected]>
> > wrote:
>
> > > Try adding an updateEndTimeColumn method in your form :
>
> > > class GameForm extends ...
> > > {
> > > // ......
>
> > > public function updateEndTimeColumn($value)
> > > {
> > > die("yes !");
> > > $this->getObject()->setEndTime($value);
> > > }
>
> > > }
>
> > > Alexandre
>
> > > 2009/10/23ashton<[email protected]>
>
> > > > I have already added those. The widget shows up on the edit page,
> > > > just without any content in it. i.e. it's always at 00:00
> > > > thought I had that info on there, sry.
>
> > > > GameForm.class.php
> > > > protected $minutes = array('00','05',
> > > > 10,15,20,25,30,35,40,45,50,55);
> > > > public function configure()
> > > > {
> > > > $timeOptions = array('can_be_empty' => false,
> > > > 'minutes' => $this->minutes);
>
> > > > $this->widgetSchema['end_time'] = new sfWidgetFormTime
> > > > ($timeOptions);
> > > > $this->validatorSchema['end_time'] =
> > > > new sfValidatorTime(array('required' => false));
>
> > > > On Oct 22, 4:37 pm, Alexandre SALOME <[email protected]>
> > > > wrote:
> > > > > You should add widget/validator to your form.
>
> > > > > 2009/10/22ashton<[email protected]>
>
> > > > > > Hi,
> > > > > > I'm trying to add a method ('endTime') that doesn't exist in the
> > > > > > model, it's essentially a convenience method to set just the time
> > > > > > part
> > > > > > of time_ts which is a timestamp. It shows up properly in the list,
> > > > > > however, the widget is never populated with a value in the edit
> > > > > > page.
> > > > > > As far as I can tell, getEndTime never even gets called when loading
> > > > > > the edit page, because when I put a 'die()' in there, execution
> > > > > > never
> > > > > > stops (although it does on the list page)
> > > > > > Thx!
>
> > > > > > Game.class.php
> > > > > > public function getEndTime($format = 'H:i') {
> > > > > > return date($format, strtotime($this->getEndTs()));
> > > > > > }
>
> > > > > > public function setEndTime($time) {
> > > > > > $this->setEndTs($this->getDate().' '.$time);
> > > > > > }
>
> > > > > > generator:
> > > > > > class: sfDoctrineGenerator
> > > > > > param:
> > > > > > model_class: Game
> > > > > > theme: jroller
> > > > > > non_verbose_templates: true
> > > > > > with_show: false
> > > > > > singular: ~
> > > > > > plural: ~
> > > > > > route_prefix: game
> > > > > > with_doctrine_route: 1
>
> > > > > > config:
> > > > > > actions: ~
> > > > > > fields:
> > > > > > league_id: { label: League }
> > > > > > field_id: { label: Field }
> > > > > > home_team_id: { label: Home Team }
> > > > > > away_team_id: { label: Away Team }
> > > > > > game_status_id: { label: Status }
> > > > > > start_ts:
> > > > > > label: Start
> > > > > > help: The day and time the this game starts
> > > > > > end_ts:
> > > > > > label: End
> > > > > > help: The date and time that this game ends
> > > > > > end_time:
> > > > > > label: End
> > > > > > help: The time that this game ends
> > > > > > list:
> > > > > > display: [field, =game_status, home_team_id, away_team_id,
> > > > > > start_ts, end_ts, end_time, score]
>
> > > > > > filter: ~
> > > > > > form:
> > > > > > display: [field_id, game_status_id, home_team_id,
> > > > > > away_team_id, start_ts, end_ts, end_time]
> > > > > > edit: ~
> > > > > > new: ~
>
> > > > > > symfony 1.2 / doctrine
>
> > > > > --
> > > > > Alexandre Salomé -- [email protected]
>
> > > --
> > > Alexandre Salomé -- [email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---