我正在尝试使用以下模板呈现表单:
function FacebookForm($fbFields) {
$actions = new FieldSet(
new FormAction('doFaceBookForm', 'Register')
);
$memberfields = singleton('XEUser')->getMemberFormFields();
$fields = new FieldSet();
$reqFields = array();
foreach($fbFields as $key => $value){
switch($value){
case 'Gender':
$fields->push($memberfields->fieldByName('Gender'));
$reqFields[] = 'Gender';
break;
case 'DateOfBirth':
$fields->push($memberfields->fieldByName('DateOfBirth'));
$reqFields[] = 'DateOfBirth';
break;
}
}
$validator = new RequiredFields($reqFields);
$form = new Form($this, 'FaceBookForm', $fields, $actions,$validator);
$form->disableSecurityToken();
return $form->renderWith(array('FacebookController','Page'));
//return $form;
}
当我只是return $form
出现我的表单但在默认的 contentController.ss 中时,我创建了一个新模板并添加了return $form->renderWith(array('FacebookController','Page'));
. 当我这样做时,我得到了应该在页面中的所有内容,但根本没有应用任何样式,甚至没有出现表单。这是我的 FacebookController 模板:
<div id="left">
<h2>Thankyou for signing up with your Facebook account</h2>
<p>The following details could not be obtained from your Facebook account, please enter them now.</p>
$form
</div>
<div id="right">
</div>
任何人都可以对此有所了解吗?