New assignment type

New assignment type

by Gregory JB -
Number of replies: 1

So, I created a new assignmnet type in Moodle version 2.2 and it works fine, but now I want to add an extra field to the assignmnet creation form and I don't know how to save the value into the database.

I added a radio button using the following:

$radioarray=array();
$radioarray[] =& $mform->createElement('radio', 'yesno', '', get_string('yes'), 1, $attributes);
$radioarray[] =& $mform->createElement('radio', 'yesno', '', get_string('no'), 0, $attributes);
$mform->addGroup($radioarray, 'radioar', '', array(' '), false);

I am aware that there are 4 fields available in the assignment table in the database, so I would like to save the result of the radio button in var2.
How do i do this?
Average of ratings: -
In reply to Gregory JB

Re: New assignment type

by Damyon Wiese -

The easiest way is to call your element var2

$mform->createElement('radio', 'var2'...