I read the other reply by Dominique, and while it works, it is definitely not the Moodle recommended way to create a form.
https://docs.moodle.org/dev/lib/formslib.php_Form_Definition This page defines what elements you can include within a form.
I would highly recommend not basing your development off old Moodle core code. Just because it is in core, does not mean it is doing it the best way.
Let me know if you have any questions! Hope this helped.