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

pass moodle_url to moodle_form constructor as action instead of passing url as a string

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.9
    • None
    • Libraries
    • None
    • MOODLE_19_STABLE

    Description

      I attach a simple patch to optionally pass a moodle_url object (see http://docs.moodle.org/en/Development:lib/weblib.php_moodle_url) as the action of a form instead of a string to the moodle_form constructor

      The code checks if the $action param is a string or a moodle_url object. If it is a moodle_url object the object outputs the action url without any GET params and the params stored in the moodle_url oject are output as hidden params.

      This is useful for complex pages where there are many GET params passing data from page call to page call. The hidden params can be used to pass an array of params not related to the form action from page to page. And the page params will always be processed in one place by optional_param / required_param at the top of the script.

      The params are not output by the get_data method.

      Attachments

        Activity

          People

            dougiamas Martin Dougiamas
            jamiesensei Jamie Pratt
            Nobody Nobody
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: