php - How to control the content (text) to display in a $form->input? -


folks. i'm starting cakephp , after reviewing tutorial ( http://book.cakephp.org/view/1543/simple-acl-controlled-application ) , after having used "cake bake" command generate models, controllers , views , fine, when visit post's add view (views \ posts \ add.php), find instead of showing input text username, shows select usernames.

this line in post's add view show select.

echo $this->form->input('user_id'); 

postscontroller :

function add() { // other code       $users = $this->post->user->find('list');     $this->set(compact('users')); } 

although know how display username of logged-in user, don't know how control content show in $this->form->input() because if use variable not part of "post" model , it's shown , label input.

have idea how solve this??

p.s. i've been trying find information on cookbook , haven't been able find specific situation :(

if want add string in value of input, try :

echo $form->input('my label text',array('value'=>'the value string','type'=>'hidden'));  

that make input hidden, , set value.
or remove type=>hidden , have value, can add things disabled , such in there, or modify div creates, use div'=>array() , put div options in array... hope helps.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -