formslib is the preferred Moodle way of creating and processing forms in the Moodle system. It provides easy mechanisms to:
Define specific form elements for your form
Ensure that your output complies with XHTML Strict DTD and 508 accessibility
Customize display format with standard CSS
Process data securely without extra processing
Validate data and provide user feedback according to your definitions
Easily add Help pop-ups to any form element
Display shortcut form element groups for specific Moodle functionality
formslib uses the PEAR QuickForm libraries, and extends these for specific Moodle functionality. It can likewise be used to add more specific form elements, through extension.
In most cases, using it is simply a matter of creating a new class that extends the Moodle class, moodleform
, and then adding your own definitions. Once defined, you can instantiate an object of the new class, initialize it, load data into it, extract submitted data from it...