How to add several entries to a section from a moodle dataform?

269 views Asked by At

I have a question regarding moodle. Can anyone advise on how to set up a dataform in moodle, for the entry template? I need the possibility for the user to add several entries for a section from the dataform.

As an example, if the dataform contains -Name -Age -Phone number -Location

The user will be able to complete only one time the name and the age, but will have the capability to add several phone numbers and locations.

Could you please advise? Thanks!

1

There are 1 answers

0
Tony On

It sounds like you need repeating elements, with a button to allow the user to add e.g. another phone number field to the form. You should be able to adapt the code for the 'choice options' fields in the Choice module's config form, on lines 41-70 of https://github.com/moodle/moodle/blob/master/mod/choice/mod_form.php.

Hope this helps.