Hi Bakers

I have an app were users can add their queries(ItQueries/add). When the IT 
department views the query (ItQueries/view/1) they should be able to 
comment/respond to it. What i have done so far is.

In the view of the IT query i have called an element for the IT department 
to add a response. below is how im calling the element

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

On submit of the ItQueryResponses i would like the action to redirect to 
the view page of the ItQueris with its comment underneath it.

Here is my code for my element

<?php echo $this->Form->create('ItQueryResponse', array('action' => 
'add')); ?>
<?php echo __('Add It Query Response'); ?>
<?php
echo $this->Form->input('it_query_id');
echo $this->Form->input('response');
?>
<?php echo $this->Form->end(__('Submit')); ?>

Here is my add function for the ItQueryResponseController

    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('Controller' => 'ItQueryResponses', 'action' => 
'view'));
    } else {
    $this->Session->setFlash(__('The it query response could not be saved. 
Please, try again.'));
    }
    }
    }

Here is my code for the ItQueryResponses view

    <h2><?php  echo __('It Query Response'); ?></h2>
    <dl>
    <dt><?php echo __('Response'); ?></dt>
    <dd>
    <?php echo h($itQueryResponse['ItQueryResponse']['response']); ?>
            &nbsp;
    </dd>
    <dt><?php echo __('Created'); ?></dt>
    <dd>
    <?php echo h($itQueryResponse['ItQueryResponse']['created']); ?>
            &nbsp;
    </dd>
    </dl>

If anyone can show me how i redirect to the ItQueryResponses view and have 
the ItQueryResponse underneath the view that would be awesome.

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