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

formslib makes my head catch fire with rage.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.4, 2.0
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      the combination of:

      • no submit button
      • validation
      • data_after_definition

      =RAGE.

      Here's the problem. I'm registering a non-submit submit button to add stuff to a page. Then, in data_after_definition, I detect whether that button was pressed, and do some extra stuff.
      However, the extra stuff relies on the form being valid.... and the validation routine a) gets called AFTER data_after_definion and b) not at all when a no submit button was pressed.

      I think this is BROKEN, however I guess current code relies in it.

      So attached is a patch that

      a) abstracts the moodle validation logic OUT of the is_validated function (which currently messes with data_after_definition stuff) and b, gives the new function a parameter to override the not calling validate when a no submit button was pressed.

      It's a safe patch and doesn't break BC at all.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: