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 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.


Reply via email to