Empty inptuts without Form->create()


#1

Hi!
I’ve got form with inputs, some make manually in html/php some as Form->input
On top of the form is “if” and I echo $this->Form->create($order) when I allow edition and don’t echo this when I want to prevent edition.

But I saw today that when there is no Form->create my Form->inputs are displayed blank without default value passed in $order (checked in debug)

Can I pass some additional args to Form->input or change some config and see those values?


#2

You can pass ‘value’ option

$this->Form->input('name', [
    'value' => 'Pre filled name',
]);

#3

If you want to prevent edition do not use a form just display the values as strings.
And do not forget to prevent edition in the controller also.


#4

Thank you guys, I will check value options, it is just more convenience to me to add one if on top of the template and not many ifs on every single displayed data. Also it keeps same look.
Of course I’ve got also check on controller side.