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
>
> <?php echo $this->Form->create('ItQueryComment'); ?>
> <?php echo __('Add It Query Comment'); ?>
> <?php
> echo $this->Form->hidden('it_query_id');
> echo $this->Form->input('comment');
> ?>
>
> <?php echo $this->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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.