Symfony form->bind fails
Posted
by Shawn Craver
on Stack Overflow
See other posts from Stack Overflow
or by Shawn Craver
Published on 2010-05-24T17:48:08Z
Indexed on
2010/05/24
17:51 UTC
Read the original article
Hit count: 191
I'm working with a few custom forms, and one of them isn't binding it's values on a POST. I'm using the same logic for each, and only one of them isn't working. Here's the code:
public function executeMediaFileUpload(sfWebRequest $request) {
$this->form = new MediaFileUploadForm();
if (!$request->isMethod('POST'))
$psk = $request->getParameter('psk');
else {
$this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
$this->logMessage('VALUE: ' . $this->form->getValue('version'));
$psk = $this->form->getValue('application');
}
$this->logMessage('PSK: ' . $psk);
$app = Doctrine::getTable('Application')->find(array($psk));
$this->form->setDefault('application', $app->getPsk());
$this->form->setDefault('version', $app->getVersion()->getLast()->getPsk());
On the initial GET, I can see the value passed in via psk getting set as the default for application in the generated HTML, and all the values show up in the POST request in Firebug, but after I bind the form, it still contains no values.
© Stack Overflow or respective owner