Jump to:

5541 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » My FormAction is not redirecting

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 839 Views
  • otherjohn
    Community Member
    125 Posts

    My FormAction is not redirecting Link to this post

    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) {    

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.