Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-32970

CLONE - Using compare rule results in fatal error in getValidationScript function

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • None
    • 2.2.2
    • Forms Library
    • None
    • MOODLE_22_STABLE
    • Easy

      Improving usability of $mform addRule for "compare" (Common Rule Types):

      old description

      Improving usability of question editing I found that code below result in error:

      $mform->addElement('text',$repeatname,$repeatstring,array('size'=>3));
      $mform->addElement('hidden', $repeathiddenname, $repeats);
      $mform->addRule($repeatname,null,'required',null,'client',true);
      $mform->addRule($repeatname,null,'nonzero',null,'client',true);
      //$mform->addRule(array($repeatname, $repeathiddenname),'You can\'t delete blanks','compare','>=','client',true);//uncommenting this line results in error in getValidationScript

      If you uncomment the last line you receive
      "Fatal error: Call to a member function on a non-object in z:\home\moodle\www\lib\formslib.php" Line: 1799
      The line with error is "$onBlur = $element->getAttribute('onBlur');" in function getValidationScript

            Unassigned Unassigned
            moien.abadi Moien Abadi
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.