Tuesday, March 5, 2013

How to define a checkbox variable in Cakephp

I have a form in my Plugin elements and what i would like to insert the checkbox value into a table named it_queries and field status_type and its giving me an error  Undefined variable: variableValue [APP\Plugin\Feedback\View\Elements\comment_add.ctp, line 37] .I have declared the variable in my controller like this

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

and this is line 37 thats giving me the error

Below is the Controller code

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

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

and in the add view in my element here is how i am trying to accessing the variable value

    echo $this->Form->checkbox('ItQuery.status_type', array('type' => 'hidden', 'value'=>$variableValueStatus));

If someone can show me how to fix this, 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+unsubscribe@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.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate