Note:

This site is no longer used and is in read-only mode. Instead please go to our new Moodle Developer Resource site.

Talk:Form API: Difference between revisions

From MoodleDocs
eric M (talk | contribs)
 
Line 7: Line 7:


The documentation should be clear about where you should put all the different sections of code.
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

Latest revision as of 11:28, 2 April 2018

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