Skip to content

Commit

Permalink
MDL-42869 calendar: HTML validation check fails on add event screen
Browse files Browse the repository at this point in the history
  • Loading branch information
danielneis committed Apr 23, 2014
1 parent e471fc6 commit 912af66
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions calendar/event_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,23 @@ function definition () {
$mform->addRule('timestart', get_string('required'), 'required');

$mform->addElement('header', 'durationdetails', get_string('eventduration', 'calendar'));
$mform->addElement('radio', 'duration', null, get_string('durationnone', 'calendar'), 0);

$mform->addElement('radio', 'duration', null, get_string('durationuntil', 'calendar'), 1);
$mform->addElement('date_time_selector', 'timedurationuntil', ' ');
$mform->disabledIf('timedurationuntil','duration','noteq', 1);
$group = array();
$group[] =& $mform->createElement('radio', 'duration', null, get_string('durationnone', 'calendar'), 0);
$group[] =& $mform->createElement('radio', 'duration', null, get_string('durationuntil', 'calendar'), 1);
$group[] =& $mform->createElement('date_time_selector', 'timedurationuntil', '');
$group[] =& $mform->createElement('radio', 'duration', null, get_string('durationminutes', 'calendar'), 2);
$group[] =& $mform->createElement('text', 'timedurationminutes', null);

$mform->addGroup($group, 'durationgroup', '', '<br />', false);

$mform->disabledIf('timedurationuntil', 'duration', 'noteq', 1);
$mform->disabledIf('timedurationuntil[day]', 'duration', 'noteq', 1);
$mform->disabledIf('timedurationuntil[month]', 'duration', 'noteq', 1);
$mform->disabledIf('timedurationuntil[year]', 'duration', 'noteq', 1);
$mform->disabledIf('timedurationuntil[hour]', 'duration', 'noteq', 1);
$mform->disabledIf('timedurationuntil[minute]', 'duration', 'noteq', 1);

$mform->addElement('radio', 'duration', null, get_string('durationminutes', 'calendar'), 2);
$mform->addElement('text', 'timedurationminutes', null);
$mform->setType('timedurationminutes', PARAM_INT);
$mform->disabledIf('timedurationminutes','duration','noteq', 2);

Expand All @@ -130,7 +139,7 @@ function definition () {
if ($newevent) {

$mform->addElement('header', 'repeatevents', get_string('repeatedevents', 'calendar'));
$mform->addElement('checkbox', 'repeat', get_string('repeatevent', 'calendar'), null, 'repeat');
$mform->addElement('checkbox', 'repeat', get_string('repeatevent', 'calendar'), null);
$mform->addElement('text', 'repeats', get_string('repeatweeksl', 'calendar'), 'maxlength="10" size="10"');
$mform->setType('repeats', PARAM_INT);
$mform->setDefault('repeats', 1);
Expand Down

0 comments on commit 912af66

Please sign in to comment.