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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

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

Url action and Form actions


Go to End


1298 Views

Avatar
derbro

Community Member, 1 Post

14 April 2011 at 11:26am

Hello,

i try to execute a form by

localhost/waytomyform/add/1

public function add($request) {
        $myID = $request->param('ID');
        $fields = new FieldSet(
                        new TextField('Name', 'Name'),
                        new DropdownField(
                                $name = "Student",
                                $title = "Student",
                                $source = Student::getStudentDropDown(),
                                $value = $myID
                ));              
        $form = new Form($this, "add",
                        $fields,
                        new FieldSet(new FormAction('doAdd', 'Submit'))
        );

        return array(
            'Title' => "Add Title",
            'addForm' => $form,
        );
    }

this far everything is ok

but the function doAdd never get executed
i added

public static $allowed_actions = array (
       'doAdd',
}

A form not started by urlaction could call doAdd

any Idea
Thanks