tags:

views:

247

answers:

1

Hi, I m creating an application of creating forms.I m using the Form Helper of cakePhp.. In the views

    <?php echo $form->create('Form', array('action' => 'register'));?>
    <?php echo $form->input('Form.name',array('type'=>'textbox'));?>
    <?php echo $form->end(); ?>

The form is not generated ...I m having the Forms_controller..name is ont of the field in my forms table..

Resolve it please....

+1  A: 

Try the following:

<?php echo $form->create('User', array('url' => array('action' => 'register'))); ?>
<?php echo $form->input('User.name', array('type'=>'text')); ?>
<?php echo $form->end(); ?>

That should do it. Note that "action=>register" array is wrapped in another array with "url=>". Second param of $form->create() is an array of options, not just an URL array, check the good book for other options if you need them.

Also, input type is text, not textbox. Since you have the action "register" there, I'm assuming it's a user registration form. So, instead of "Form" as param, use your user model name, i.e. probably "User".

dr Hannibal Lecter
Even i did as ur code.. Still i m getting the error as$options = array(64 "type" => "text",65 "name" => "data[Form][name]",66 "value" => null,67 "id" => "FormName"68)</pre><pre>sprintf - [internal], line ??69FormHelper::text() - CORE/cake/libs/view/helpers/form.php, line 95170FormHelper::input() - CORE/cake/libs/view/helpers/form.php, line 769
Aruna
sprintf - [internal], line ?? This is the error but i dont know why its happened???Please resolve it...
Aruna
Uh...try removing "array('type'=>'text')"..string input is the default. Where did you get the "FormName" from?
dr Hannibal Lecter