I have a IT query system where users add their queries. When i view the 
query i should be able to add a response to the query. The response should 
be added to table named it_query_responses and Model name is 
ItQueryResponse. 

Through an element i am including the add response in the view.ctp for the 
IT queries. Challenge that i am having now is that the element is not 
saving the response into the it_query_responses table.

Here is my add function for response controller

    public function add() {
    if ($this->request->is('post')) {
    $this->ItQueryResponse->create();
    if ($this->ItQueryResponse->save($this->request->data)) {
    $this->Session->setFlash(__('The it query response has been saved'));
    $this->redirect(array('action' => 'index'));
    } else {
    $this->Session->setFlash(__('The it query response could not be saved. 
Please, try again.'));
    }
    }
    $itQueries = $this->ItQueryResponse->ItQuery->find('list');
    $hrEmployees = $this->ItQueryResponse->HrEmployee->find('list');
    $itQueryStatuses = $this->ItQueryResponse->ItQueryStatus->find('list');
    $this->set(compact('itQueries', 'hrEmployees', 'itQueryStatuses'));
    }

and here is how i am calling my element after the closing div in view.ctp

    <?php echo $this->element('ItQueryResponses/add'); ?>

here is the code for my element

    <?php echo $this->Form->create('ItQueryResponse'); ?>
    <fieldset>
    <legend><?php echo __('Add It Query Response'); ?></legend>
    <?php
    echo $this->Form->input('it_query_id');
    echo $this->Form->input('hr_employee_id');
    echo $this->Form->input('response');
    echo $this->Form->input('it_query_status_id');
    ?>
    </fieldset>
    <?php echo $this->Form->end(__('Submit')); ?>    
    

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.


Reply via email to