What if you include the model name in your field? <?php echo $form->input('Message.message'); ?>
or <?php echo $form->input('Message.message', array('type'=>'text')); ?> Adam On Dec 28, 3:53 pm, krr <[EMAIL PROTECTED]> wrote: > I tried it, didn't work. I think the problem is because the field name > is the same as the model. Since the index page has data(the result > set) associated with 'messages' variable, the field may be getting > displayed as dropdown instead of textbox. > > For the time being, I have found a workaround. Instead of $form->input, I am > using $form->text, but I want to know the correct fix for > > this problem. > > On Dec 27, 6:42 pm, hydra12 <[EMAIL PROTECTED]> wrote: > > > I haven't tested this (away from my dev computer for Christmas), but I > > think that $form->input without any options is your problem. If you > > don't give it any options, cake has to guess at what kind of input you > > want. Since message belongs to user, cake thinks you want a select > > box. Try this: > > > <?php echo $form->input('message', array('type'=>'text')); ?> > > > Note - I haven't tested this, just going from memory and a quick check > > of the > > api:http://api.cakephp.org/1.2/class_form_helper.html#986b871ad98a20ed1ce... > > > Hope that helps! > > hydra12 > > > On Dec 27, 5:23 am, krr <[EMAIL PROTECTED]> wrote: > > > > php version: 4.4.2 > > > cakephp: 1.2 > > > > I have 2 models, User and Message. User is for authenticating users > > > and Message are the messages from users. Message belongsTo User. > > > > messages table fields > > > message (message body) > > > user_id (foreign key to users, auto filled from session) > > > created_date (current timestamp, auto filled) > > > > To keep UI simple, I have put an 'Add Message' form in the index page > > > of messages. > > > > <?php echo $form->create('Message');?> > > > <fieldset> > > > <legend><?php echo sprintf(__('Add %s', true), > > > __('Message', > > > true));?></legend> > > > <?php > > > echo $form->input('message'); > > > ?> > > > </fieldset> > > > <?php echo $form->end('Submit');?> > > > > The problem is the above form shows the input for message as a drop > > > down (instead of textbox) with all the values from all columns in the > > > messages table. > > > > Any clue what might be wrong? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---