I want to set a userID while a form is processed in processForm
, located in actions.class.php
. The problem is, I have unset the userID field and somehow I can't set a value for that. I've searched but I couldn't find anything useful.
I don't want to set the value in a hidden field or something like this, since the userID isn't the only value I want to set. Some values are based开发者_开发问答 on the form request itself.
Thanks.
You can change fields right after the binding - for example this is in my processForm
method
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid())
{
$model = $form->save();
$model->setField(value);
$model->save();
}
Ensure you call the save() method else the changes wont be visible
精彩评论