Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

My FormAction is not redirecting




Community Member, 125 Posts

8 October 2010 at 2:27am

Hi all,

I am setting up a background task (facebook related) in the CMS that requires an iFrame to perform.
The iFrame loads up the facebook signin/permissions. Once given that, the iframe reloads and shows some information in a dropdown button for the user to select. When they select and submit, the form is supposed to perform an action but its not redirecting properly. It is redirecting to "/FBController/iframe/SelectPageForm" and not firing anything.

Now I probably have this all flubbed up but maybe someone can help me here.
in one of my config pages in the CMS i have

$fields->addFieldToTab("Root.Social", new FBAuthField("SetFBPermissions","Authenticate"));

for my FBAuthField.php I have

class FBAuthField extends FormField {

public function Field($id = null) {

$data = $this->form->getRecord();

if($id && is_numeric($id)) {
$parentID = $id;
} elseif($data) {
$parentID = $data->ID;
} else {
$parentID = null;

$iframe = "<iframe name=\"{$this->name}_iframe\" src=\"FBController/iframe/$parentID/\" style=\"height: 282px; width: 425px; border: none;\" frameborder=\"0\"></iframe>";

return $iframe;



Then for my FBController I have

class FBController extends Controller
static $allowed_actions = array ('iframe');
public function FBForm()
               $alist = DataObject::get('Accounts');
               if ($alist) {
                  $alist = $alist->toDropdownMap('page_id', 'page_name');
               $fields = new FieldSet(new DropdownField('accountID', 'Accounts', $alist));
               $actions = new FieldSet(new FormAction("selectPage", "Select Account"));
               return new Form($this, "SelectPageForm", $fields, $actions);

public function selectPage($data, $form) {