Please note that the forum isn't realy used anymore.

If you have questions, want support or just simply want to talk to us you can find us on slack.

 

Setting value of hidden field in frontend form

Hi

What is the best way of setting a value of a hidden field in a frontend form. I got:

$this->frm->addText('activityId')->setAttributes(array('required' => null, 'type' => 'hidden'));

But if i had the attribute 'value'=>'1' it throws an error that the key value can not be overwritten. Any way of getting around this?

Hi bram, would this be a solution? You can use a hidden field instead of textfield. And the value can be set as a parameter of the addHidden method, just like addText etc... Or did you try that already?

$this->frm->addHidden('activityId', 1)->setAttributes(array('required' => null));

Comment

The forum is deprecated in favor of our Slack channel, which provides real-time support for your issues.

Join us on Slack here: https://fork-cms.herokuapp.com/