Fields For

fields_for

  • Syntax: void fields_for ( $object_name, &$object)
  • Description: Creates a scope around a specific model object like form_for, but doesn't create the form tags themselves. It is suitable for specifying additional model objects in the same form.
  • Example:
<?php $person_form = $this->form_for('person', $Person, array('url' => array('action'=>'update'))); ?>
First name: <?= $person_form->text_field('first_name'); ?>
Last name : <?= person_form->text_field('last_name'); ?>
<?php $permission_fields = $form_helper->fields_for('permission', $Person->permission); ?> 
Admin? : <?= $permission_fields->check_box('admin'); ?> 
<?= $person_form->end_form_tag(); ?>

Note: This also works for the methods in FormOptionHelper and DateHelper that are designed to work with an object as base. Like collection_select and datetime_select. This note needs more of an explanation and also references.

 
helper-fields.txt · Last modified: 2008/02/26 13:33 by alake
 

The Akelos Framework was created by Bermi Ferrer and other contributors.
Potions of the code and documentation have been ported from Ruby on Rails.

The Akelos Framework is released under the LGPL license.

"Akelos", "Akelos Framework", and the Akelos logo are trademarks of Bermi Labs All rights reserved.

Wiki driven by DokuWiki