Skip to main content

Form elements

Custom form elements for Moodle

In development

How to use moodle forms

Forms are constructed using lib/formslib.php. Using the addElement methods in php a set of different form element types can be added to a form. For more info visit the Moodledocs page for forms

<?php 
    $mform->addElement('button', 'intro', get_string("buttonlabel"));
 ?>

Form elements are styled using Moodle templates which are rendered through PHP. Themes can override these templates.

Form elements are styled using the .form-control class, see the Bootstrap docs for more info.

core_form/element-advcheckbox
core_form/element-checkbox
core_form/element-date_time_selector
core_form/element-duration-inline
core_form/element-editor
core_form/element-filemanager
core_form/element-filepicker
core_form/element-group
core_form/element-passwordunmask
core_form/element-radio-inline
core_form/element-select-inline
core_form/element-select
core_form/element-selectgroups
core_form/element-selectyesno
core_form/element-static
core_form/element-submit-inline
core_form/element-submit
core_form/element-tags
core_form/element-text-inline
core_form/element-text
core_form/element-textarea