Wednesday, September 2, 2009

Re: Can select forms not return an array?

A few things your doing wrong and should change immediately.

Do not call error(), text() (or the other variants, select(), radio
()).

The following code:

<?php echo $form->label('Devotion.name', 'Name of Devotion'); ?
>
<?php echo $form->error('Devotion.name'); ?>
<?php echo $form->text('Devotion.name', array('size' =>
'80') ); ?>

Can be changed to:

<?php echo $form->input('name', array('size' => 80, 'label' => 'Name
of Devotion')); ?>

Also this is not needed either:

'selected'=>$html->value('Disciplines.2.discipline_id'),

All you would need to do is set $this->data in the controller.

$this->data['Disciplines'][2]['discipline_id'] = 'value';

And finally to fix your array, remove the "multiple" index from all
your selects and see if that works.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: