My favorites | Sign in
Project Logo
                
Search
for
Updated Dec 12, 2008 by tobiasz.cudnik
CakeForms  

CakeForms plugin automatically converts HTML markup forms into executable PHP code using CakePHP's default FormHelper. It's used to rapidly mix designed template with CakePHP form controls. It also handles error messages.

It's use is quite simple

// load plugin
->plugin('CakeForms')
// find form in the template
->find('form')
  // convert form
  ->formToCakeForm(
    array('Post', array('action' => 'edit')), $form
  );

Sample output (see full file)

<div class="input textarea">
<label for="body">Body</label><?php 
 print $form->error('body', null, array (
  'before' => '<p class="errorField">',
  'class' => 'errorField',
  'after' => '</p>',
));
                        print $form->input('body',
                                array (
  'type' => 'textarea',
  'div' => '',
  'legend' => false,
  'label' => false,
  'id' => 'PostBody',
)
                        ); 
 ?>
</div>

For further reading see


Sign in to add a comment
Hosted by Google Code