I have a proper working form created from moodle Form API. But I have a requirement to separate that form into two collapsible div areas which the forms get executed from a single submit button. Is there a way to achieve this?
Current Form:
class simplehtml_form extends moodleform {
//Add elements to form
public function definition() {
global $CFG;
$mform = $this->_form; // Don't forget the underscore!
$mform->addElement('text', 'name', get_string('name'));
$mform->setType('name', PARAM_NOTAGS);
$mform->setDefault('name', 'Please enter name');
$mform->addElement('text', 'email', get_string('email'));
$mform->setType('email', PARAM_NOTAGS);
$mform->setDefault('email', 'Please enter email');
...
}
//Custom validation should be added here
function validation($data, $files) {
return array();
}
}
I want to show above two name and email fields into two different div areas. For an example div 1 should contain the name field and div 2 should contain the email field.