Rapid Application Development with Open Source Software

Next: Building Controller Actions for Comments UP: TOC

The Form for entering comments is defined in a reusable element.

The elements looks as follows:

' . __('Your Question') . ' / ' . __('Your Feedback') . '

'; echo $this->Form->create('Comment', array('inputDefaults' => array('div' => 'form-group','label' => false, 'wrapInput' => false, 'class' => 'form-control'), 'class' => 'well paddingTop2','type'=>'file','url' => '/comments/add/')); echo '
'; echo $this->Form->textarea('Comment.content',array( 'rows' => '6', 'cols' => '80', 'required' => true, 'placeholder' => __('Your Comment') , 'error' => array('minlength' => __('Minimum length of 3 characters') ) )); echo '
'; echo '
'; echo $this->Form->input('Comment.email',array( 'placeholder' => __('Your Email') . ', ' . __('Required, never shown'), 'required' => true )); echo '
'; echo $this->Form->input('sid',array( 'placeholder' => __('Security Number') . ', ' . __('Enter the number displayed in the blue area below'), 'required' => true )); echo '
'; echo ''; echo '
'; if (!empty($chapter_id)) { echo $this->Form->hidden('Comment.chapter_id', array('value'=> $chapter_id)); } if (!empty($book_id)) { echo $this->Form->hidden('Comment.book_id', array('value'=> $book_id)); } echo $this->Form->end(array('label' => __('Submit'), 'class'=> 'btn btn-primary')); echo '';
Next: Building Controller Actions for Comments UP: TOC