Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorsignalwarfare
     
    I have a drop down menu with a bunch of values loaded using the form_options_helper

    <?php echo $form_options_helper->select('ProgramParticipant', 'active_program_id', $program_participant_helper->get_program_names(), array(), array('prompt'=>true,'selected' => null))?>

    and a search function in the controller that is activated after the user hits submit.

    function search()
    {
    if($this->Request->isPost())
    {

    $foo = $this->ProgramParticipant->get('selected_value');

    $options = array('conditions' => array('active_program_id = ?', $foo));

    $this->ProgramParticipants =& $this->ProgramParticipant->find('all', $options);

    }
    }

    I'm trying to set $foo as the selected value in order to filter the results of the search. I know my function is working properly because if I set $foo manually it loads everything properly (according to the value I set it as), but I can't figure out how to pass the selected value in the view, into the controller and I feel like I've searched through the site over and over again with no luck, I'm assuming that this is something so simple most people with real coding experience already know the answer but unfortunately my PHP and Akelos experience is very limited at the moment.
    • CommentAuthorpogeybait4883
     

    check the source for your form (from your browser) and look at the "name" of the select box or whatever kind of form element it is creating.. Then in your code, use

    $foo = $this->params["name"]; //replace "name" with the name of the form element.