Re: How to hide id input and give it a value in cakephp
Try passing attribute with input echo $ this-> Form-> input ('it_query_id', array ('type' => 'hidden') ); On 7 Mar 2013 11:59, "Victor Musvibe" wrote: > > I have 2 models that are related and what i would like to do is in my add view i would like to set the id field as a hidden field so that it doesnt show on my add view, when i set it to hidden the form doesn't submit. Is there a way of passing the id value as a hidden field? > > here is my add view > > Form->create('ItQueryComment'); ?> > > echo $this->Form->hidden('it_query_id'); > echo $this->Form->input('comment'); > ?> > > Form->end(__('Submit')); ?> > > and here is add function for the ItQueries Controller > > public function add() { > if ($this->request->is('post')) { > $this->ItQuery->create(); > if ($this->ItQuery->save($this->request->data)) { > $this->Session->setFlash(__('The it query has been saved')); > $this->redirect(array('action' => 'index')); > } else { > $this->Session->setFlash(__('The it query could not be saved. Please, try again.')); > } > } > $itQueryTypes = $this->ItQuery->ItQueryType->find('list'); > $this->set(compact('itQueryTypes')); > } > > Thank you in advance > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to hide id input and give it a value in cakephp
Thanks will keep that in mind next time i post a question On Thu, Mar 7, 2013 at 2:35 PM, euromark wrote: > If you feel the need to crosspost all over the www, it would be nice to > link those other posts - like > > http://stackoverflow.com/questions/15269787/how-to-hide-id-input-and-give-it-a-value-in-cakephp > > this way people can take a look there if the answer might already be > answered and avoid giving the exact same answer again > > > > Am Donnerstag, 7. März 2013 12:59:05 UTC+1 schrieb Victor Musvibe: > >> I have 2 models that are related and what i would like to do is in my add >> view i would like to set the id field as a hidden field so that it doesnt >> show on my add view, when i set it to hidden the form doesn't submit. Is >> there a way of passing the id value as a hidden field? >> >> here is my add view >> >> Form->create('**ItQueryComment'); ?> >> >> > echo $this->Form->hidden('it_query_**id'); >> echo $this->Form->input('comment'); >> ?> >> >> Form->end(__('Submit'))**; ?> >> >> and here is add function for the ItQueries Controller >> >> public function add() { >> if ($this->request->is('post')) { >> $this->ItQuery->create(); >> if ($this->ItQuery->save($this->**request->data)) { >> $this->Session->setFlash(__('**The it query has been saved')); >> $this->redirect(array('action' => 'index')); >> } else { >> $this->Session->setFlash(__('**The it query could not be saved. >> Please, try again.')); >> } >> } >> $itQueryTypes = $this->ItQuery->ItQueryType->**find('list'); >> $this->set(compact('**itQueryTypes')); >> } >> >> Thank you in advance >> > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to a topic in the > Google Groups "CakePHP" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/cake-php/P8fdBapI_1c/unsubscribe?hl=en. > To unsubscribe from this group and all its topics, send an email to > cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to hide id input and give it a value in cakephp
If you feel the need to crosspost all over the www, it would be nice to link those other posts - like http://stackoverflow.com/questions/15269787/how-to-hide-id-input-and-give-it-a-value-in-cakephp this way people can take a look there if the answer might already be answered and avoid giving the exact same answer again Am Donnerstag, 7. März 2013 12:59:05 UTC+1 schrieb Victor Musvibe: > > I have 2 models that are related and what i would like to do is in my add > view i would like to set the id field as a hidden field so that it doesnt > show on my add view, when i set it to hidden the form doesn't submit. Is > there a way of passing the id value as a hidden field? > > here is my add view > > Form->create('ItQueryComment'); ?> > > echo $this->Form->hidden('it_query_id'); > echo $this->Form->input('comment'); > ?> > > Form->end(__('Submit')); ?> > > and here is add function for the ItQueries Controller > > public function add() { > if ($this->request->is('post')) { > $this->ItQuery->create(); > if ($this->ItQuery->save($this->request->data)) { > $this->Session->setFlash(__('The it query has been saved')); > $this->redirect(array('action' => 'index')); > } else { > $this->Session->setFlash(__('The it query could not be saved. Please, > try again.')); > } > } > $itQueryTypes = $this->ItQuery->ItQueryType->find('list'); > $this->set(compact('itQueryTypes')); > } > > Thank you in advance > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.