ウィジェットを構成しようとしているembeddedFormがあります。
現在、次の_form.php
ようなテンプレートでフォームを出力しています。
<?php echo $form ?>
これは素晴らしいことですが、フォームフィールドを特定の順序で配置したいので、次のことを試してみようと思いました。
<?php echo $form['firstname']->renderRow() ?>
<?php echo $form['lastname']->renderRow() ?>
<?php echo $form['email_address']->renderRow() ?>
これにより、無効なウィジェットエラーが発生します。
現在、2つのフォームがあります。1つは基本フォームで、別のフォームを埋め込むだけです。
<?php
class labSupportForm extends sfGuardUserAdminForm
{
public function configure()
{
$form = new labSupportProfileForm($this->getObject()->getProfile());
$this->embedForm('profile', $form);
unset($this['is_super_admin'], $this['is_admin'], $this['permissions_list'], $this['groups_list']);
$this->widgetSchema['profile'] = $form->getWidgetSchema();
$this->validatorSchema['profile'] = $form->getValidatorSchema();
}
public function save($con = null)
{
$user = parent::save($con);
if (!$user->hasGroup('Lab Support'))
{
$user->addGroupByName('Lab Support');
$user->save();
}
return $user;
}
}
と:
<?php
class labSupportProfileForm extends sfGuardUserProfileForm
{
public function configure()
{
unset($this['email_new'],
$this['validate_at'],
$this['validate'],
$this['address_1'],
$this['address_2'],
$this['city'],
$this['country'],
$this['postcode'],
$this['created_at'],
$this['updated_at'],
$this['user_id'],
$this['is_super_admin'],
$this['is_admin'],
$this['permissions_list'],
$this['groups_list']);
}
}
しかし、ウィジェット/バリデーターをに追加してlabSupportForm
保存すると、firstname
値は保存されません。
この値が節約されると思っていたので、私はここで何か間違ったことをしていますか?
ありがとう