First, hi, and thank you for dataform - very powerful and working well for my application form.
I have a file field in my entry form (uploading PDFs), I try to make it required using the '*' prefix in the field name.
When I do this, the file
field does not display at all. I created an issue here :
https://tracker.moodle.org/browse/CONTRIB-8314
I am trying to compare it to other field types where required works fine (like checkbox) , renderer.php - looks like .JS is added in to do this. Am I in the right place? Thanks for any guidance :
/**
*
*/
protected function set_required(&$mform, $fieldname, $selected) {
global $PAGE;
$mform->addRule($fieldname, null, 'required', null, 'client');
// JS Error message.
$options = array(
'fieldname' => $fieldname,
'message' => get_string('err_required', 'form'),
);
$module = array(
'name' => 'M.dataformfield_checkbox_required',
'fullpath' => '/mod/dataform/field/checkbox/checkbox.js',
'requires' => array('base', 'node')
);
$PAGE->requires->js_init_call('M.dataformfield_checkbox_required.init', array($options), false, $module);
}