FormHelper::text() just generates the markup for a single input field.

FormHelper::input() can generate any type of input field (text,
password, textarea, select, radio, ...) which can be auto-detected
from the model's schema, or user-defined. It also adds a wrapper div
and error message, if wanted & applicable.

On Dec 11, 2:57 pm, Jekin <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> Question about $form helper. What's the difference between input and
> text?
>
> I have validation for fullname field in user model:
>         'fullname' => array(required' => VALID_NOT_EMPTY)
>
> Input in view:
>                     <td class="field">
>                         <?php echo $form->input('User.fullname', array('value'
> => $user['User']['fullname'], 'label'=>'')); ?>
>                         <?php echo $form->error('User.fullname',
> array('required'=>'Full name Required')); ?>
>                     </td>
>
> Here if I left the full name field empty, two error messages will be
> shown: 'required' and 'Full name Required'.
>
> However, if I use $form->text instead of $form->input:
>                     <td class="field">
>                         <?php echo $form->text('User.fullname', array('value' 
> =>
> $user['User']['fullname'], 'label'=>'')); ?>
>                         <?php echo $form->error('User.fullname',
> array('required'=>'Full name Required')); ?>
>                     </td>
> Only 'Full name Required' will be shown. Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to