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.
EDIT: Yes, the form is setup as multipart and POST. And I'm calling $this->widgetSchema->setNameFormat('values[%s]') in the form.
EDIT2: Here's the HTML for the form, and getName returns "values":
<form name="mediafiles" action="<?php echo url_for('application/mediaFileUpload') ?>" method="POST" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?> id="applications">
<div class="clear">
<div>
<?php echo $form->renderHiddenFields() ?>
<?php foreach($form as $widget): ?>
<?php if (!$widget->isHidden()): ?>
<?php echo $widget->renderLabel() ?>
<?php echo $widget->renderError() ?>
<?php echo $widget->render() ?>
<?php endif ?>
<?php endforeach ?>
</div>
</div>
<!-- Start Bottom Sub Navigation -->
<div class="subnav clear">
<a href="<?php echo url_for('application/index') ?>">Cancel</a>
<a href="<?php echo url_for('application/index') ?>" onclick="document.forms['mediafiles'].submit(); return false;">Upload</a>
</div>
<!-- End Bottom Sub Navigation -->