mform if(checkbox->'checked')

Re: mform if(checkbox->'checked')

by Yuriy Hetmanskiy -
Number of replies: 0

Hello all!

I faced with a same situation In my code. Error has been shown for "addRule" .  Sample:

        $radioarray[] =& $mform->createElement('radio', 'yesno', '', get_string('yes'), 1);

        $radioarray[] =& $mform->createElement('radio', 'yesno', '', get_string('no'), 0);

        $mform->addGroup($radioarray, 'radioarr', '', array(' '), false);

        $mform->addRule('yesno', get_string('missinanswer', 'enrol_survey'), 'required');

Change  third row solved the problem:

        $mform->addGroup($radioarray, 'yesno', '', array(' '), false);

(In addGroup and createElement must be the same name)


I will be glad if my example will help someone smile