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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.2.2
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_22_STABLE

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              moien.abadi Moien Abadi
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: