I am using a feedback plugin for my app and on the add view i am putting a 
checkbox with value Pending. I was wondering if they is a away that when 
the checkbox is ticket it will insert the checkbox value into a table named 
it_queries and field name status_type.

Here is how i am declaring my variable name in the plugin controller

    $this->set('variableValueStatus', 'Pending');

and here is the Plugin controller code

    <?php
    App::uses('FeedbackAppController', 'Feedback.Controller');

    class CommentsController extends FeedbackAppController
    {    
    public $components = array('Feedback.Comments');

    public function add($foreign_model = null, $foreign_id = null)
   {
        
    $this->set('variableValueStatus', 'Pending');
    if (empty($foreign_model) ||
    empty($foreign_id) ||
    !$this->request->is('post')
    )
    {
    return $this->redirect('/');
    }

    App::uses($foreign_model, 'Model');
    $Model = ClassRegistry::init($foreign_model);

    if (!($Model instanceof Model))
    {
    return $this->redirect('/');
    }

    if ($Model->hasAny(array($Model->primaryKey => $foreign_id)) == false)
    {
    return $this->redirect('/');
    }

    if (!isset($this->request->data['Comment']['foreign_model']) ||
    !isset($this->request->data['Comment']['foreign_id']) ||
    $this->request->data['Comment']['foreign_model'] != $foreign_model ||
    $this->request->data['Comment']['foreign_id'] != $foreign_id)
    {
    return $this->redirect('/');
    }

    $user_id = null;

    if (isset($this->Auth))
    {
    $user_id = $this->Auth->user('id');
    }

    $this->request->data['Comment']['foreign_model'] = $Model->name;
    $this->request->data['Comment']['foreign_id'] = $foreign_id;
    $this->request->data['Comment']['user_id'] = $user_id;
    $this->request->data['Comment']['author_ip'] = 
$this->request->clientIp();

    $this->Comment->create();

    if (!$this->Comment->save($this->request->data))
    {
    $this->set('validation_errors', $this->Comment->validationErrors);
    return;
    }

    
$this->redirect($this->request->referer().'#comment-'.$this->Comment->id);
    }
    }

and here is my code for the checkbox in the plugin add view

    <?php echo $this->Form->checkbox('ItQuery.status_type', array('type' => 
'hidden', 'value'=>$variableValueStatus)); ?>
    
Can some please show me how to fix this

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