kartik-v / yii2-builder

Build forms (single or tabular) easily for Yii Framework 2.0.
http://demos.krajee.com/builder
Other
100 stars 50 forks source link

How to set Hidden field a default value ? #144

Closed abdulmanan7 closed 4 years ago

abdulmanan7 commented 4 years ago
'entity_type' => [
            'type'=>TabularForm::INPUT_HIDDEN,
            'columnOptions'=>['hidden'=>true,'value'=>"App"],
            'value'=>"App", //does'nt work
            'options' => [
                'value' => "App",//does'nt work
            ],
            'initValueText' => 'App',//does'nt work
 ],

I read all documentation but no luck. Can you please help

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/91592038-how-to-set-hidden-field-a-default-value?utm_campaign=plugin&utm_content=tracker%2F776156&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F776156&utm_medium=issues&utm_source=github).
kartik-v commented 4 years ago

Setting options['value'] should work... not sure why ... you can also set entity_type as a Closure function which will allow you to set $model->entity_type.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.