I have a model class (named KanoonGood), which its corresponding Form class is:
class KanoonGoodForm extends BaseKanoonGoodForm
{
public function configure()
{
$this->widgetSchema['count_num']->setAttribute('size', '1');
$this->widgetSchema['price']->setAttribute('size', '1');
}
}
when someone calls the new action of a module based on this model class, I need to display not only one KanoonGoodForm, but 20 of them.
So I created a Form (named KanoonGoodsGroup), which has 20 embeded KanoonGoodForms:
class KanoonGoodsGroupForm extends sfForm
{
public function configure()
{
for ($i = 0; $i < 20; $i++)
{
$this->embedForm('good_'.$i, new KanoonGoodForm());
}
}
}
and then I rewrite the new action of my module as follows:
public function executeNew(sfWebRequest $request)
{
$this->form = new KanoonGoodsGroupForm();
}
and in newSuccess template, I have passed this form to a _form.php partial:
<?php include_partial('form', array('form' => $form)) ?>
and the _form.php partial is like:
<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<form action="<?php echo url_for('good/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
<table>
<tfoot>
<tr>
<td colspan="2">
<?php if (!$form->getObject()->isNew()): ?>
<?php echo link_to('Delete', 'good/delete?id='.$form->getObject()->getId(), array('method' => 'delete', 'confirm' => 'are you sure?')) ?>
<?php endif; ?>
<input type="submit" value="save" />
</td>
</tr>
</tfoot>
<tbody>
<?php echo $form ?>
</tbody>
</table>
</form>
the problem is that when I call the new action from browser, nothing is displayed, even no errors! just a white page, even without symfony dev tools!
I got stucked on this.