__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
---
layout: docs
title: "Form elements"
description: "Custom form elements for Moodle"
date: 2020-01-14T16:32:24+01:00
draft: false
weight: 30
tags:
- 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](https://moodledev.io/docs/apis/subsystems/form) page for forms
{{< php >}}
$mform->addElement('button', 'intro', get_string("buttonlabel"));
{{< / php >}}
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](/bootstrap-4.3/forms/input-group/) docs for more info.
## Example form elements
The example form below is showing an iframe with an actual Moodle form. Use the toggle options to display the different states for the form.
<iframe src="../../../../examples/formfields.php" style="overflow:hidden;height:4000px;width:100%;border:0" title="Moodle form fields"></iframe>
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| _index.md | File | 85 B | 0777 |
|
| actionmenu.md | File | 6.39 KB | 0777 |
|
| activityicons.md | File | 8.38 KB | 0777 |
|
| buttons.md | File | 5.9 KB | 0777 |
|
| coursecards.md | File | 6.26 KB | 0777 |
|
| dom-modal.md | File | 4.29 KB | 0777 |
|
| dropdowns.md | File | 13.23 KB | 0777 |
|
| dynamictabs.md | File | 2.87 KB | 0777 |
|
| example.md | File | 1.52 KB | 0777 |
|
| footer.md | File | 1.49 KB | 0777 |
|
| form-elements.md | File | 1.08 KB | 0777 |
|
| moodle-icons.md | File | 1.71 KB | 0777 |
|
| notifications.md | File | 2.55 KB | 0777 |
|
| search-input.md | File | 3.42 KB | 0777 |
|
| showmore.md | File | 1.18 KB | 0777 |
|
| toggle.md | File | 2.29 KB | 0777 |
|