Talk:Form API

Jump to: navigation, search

Usage

This section says: "For creating a form in moodle, you have to create class extending moodleform class", but WHERE do you create this class? Which .php file? Is it simplehtml_form.php?

Below the "class simplehtml_form extends moodleform" sample code the doc then says: "Then instantiate form (in this case simplehtml_form) on your page." Where do you instantiate the form? In the view.php page?

Lastly, where do you put the code that processes and saves the form data when the form is submitted?

The documentation should be clear about where you should put all the different sections of code.

As Well, When I'm trying to test the example, i have a error mesage: Coding problem: $PAGE->context was not set. You may have forgotten to call require_login() or $PAGE->set_context(). The page may not display correctly as a result