How to solve inserting parameters into the form?

Hello, I would like put some values into a form as hidden input fields.

I have got a function with name:


function detail($id = null)
	{
		//some app logic
		$this->set('detail_values', $this->Company->read(null, $id));
	}

In this function adding into detail view link, where putting as parameter id of company..

link should be>>

companies/addevaluation/1

View of addevaluation si siple form where fill some values, but i need put ID of company as hidden field..And this form then send by POST method.

I tried such as>


<?php echo $form->input( 'Rating.company_id', array( 'value' => $detail_values['Company']['ID']  , 'type' => 'hidden') ); ?>

This i tried get values by beforeRender a Filter, what is better practice for this i Cake?

Thanks for any reply..

Asked by blacksymmetry, on 9/2/10

2 Answers

try like this


echo $form->fidden( 'Rating.company_id', array( 'value' => $detailValues['Company']['ID']) );

seems like you have the right idea. you should not do it in beforeFilter though, only the action you need it in.

Answered by dogmatic69on 9/2/10

yes... hidden

dogmatic69 - on 10/2/10

<< comments | 1 | 2

function detail($id = null)
    {
        //some app logic
        $this->data = $this->Company->read(null, $id);
    }

and


<?= $form->input('Company.ID', array('type' => 'hidden')); ?>
The Model fields...

Answered by ftgoncalveson 10/2/10

<< previous next >>

Your Answer

You can use Creole Wiki Syntax to format your text.

Tagged with

Rating

0

Viewed

234 times

Last Activity

on 10/2/10