Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Perth Hackfest October 2012/Forms API

From MoodleDocs
  • Problems with Form API
    • Cannot use forms in a javascript popout (MDL-17146)
    • Cannot override how they look
    • Forms lib was done before renderers (but should not be required, otherwise we cannot use existing form libraries)
    • Handling files simpler
    • Ability to have form elements appear/disappear (now able to be accessible with ARIA attributes)
    • ARIA support is required
    • Ability to create custom form elements for plugins
    • No easy way to create special forms (eg: rubrics form)
    • Multi-step forms are not possible
    • Admin tree is a separate form library (should be unified)
    • Ability to submit by AJAX
    • Needs to be backwards compatible
    • Complex dependencies between form elements
    • label in form submit button - bad for accessibility
  • Discuss: Could forms api sort of extend web services to help in implementing ws throughout moodle? (bad performance?)
    • abstracting validation functions
    • This is blue sky perhaps as theres too much to cZhange and its too late to introduce validations into xmldb
  • Drupal forms uses hooks: Drupal Forms API ( http://drupal.org/node/751826 )
    • plugin extends forms
    • people can create local plugins to modify, reorder, etc core forms
    • form extensions can define fields, etc..
  • Existing form frameworks
  • Petr’s speech on *3’ QF2
    • frozen + hard freeze history/problems
    • we have bc issues and currently tied into QF
    • Author shares the same perspective on using code as Petr ;-)
  • Forms library should be so easy to use for first time coder.
    • should ensure sesskey
    • should have validations somehow..?
    • all the day to day stuff that we don’t want to have to think about everyday - thats the win we can get from our forms lib.
    • as few as possible bc issues from any simple bug fixes. (eg: accessibility sprint)
    • dynamic form elements/validation

Forms API breakout session notes

People Present

  • Marina,
  • Andrew Davies
  • Andrew Nicols
  • Mark Nielson

Problems at moment:

  • There aren’t any (many?) renderers in use at present
  • Forms are too long (Scroll of death)
  • Required fields not really required sometimes
  • Non-required fields sometimes required by code
  • Quickforms sucks - we need to replace it
  • Add three more answers type lists
  • We don’t support hierarchical structure of forms
    • This is display layer
    • but it should? be fed by the API layer
  • Poor support for accessibility
  • No ability to re-sort forms
  • Freeze of form elements doesn’t work
  • No support for hooking into a plugin to change it from a local plugin (for example)
  • No inline errors
    • Error checking as you go
  • No ability to be able to override a renderer for a specific form (from a plugin for example)
    • Is this a good idea (e.g. accessibility, UX consistency)
  • No modality
  • No ability to create a basic version of a form - would be useful for activity chooser to be able to display an in-line form when adding a new module as a JS overlay

Examples of potential solutions or desirable features

Drupal

Symfony Forms

Zend Framework 2?


See list of possibilities in other doc (https://docs.google.com/document/d/12WSzBHDVMIk6GwsSigDvimaA5PX74w1-U0GMK1cuKb0/edit)


LUNS - Shortforms features

Replace quickforms

Requirements:

  • must be backwards compatible or at least provide a compatibility framework
  • need to switch to renderers (fits in with Responsive Design outcomes http://goo.gk/RTChk)
  • Proper Freezing of elements
  • ARIA support
  • Allow for different layouts for forms
    • Per Form
    • Per Section
    • Per Form Element
    • Inherit from the parent section or element
    • Allow for overrides
  • Hooks
  • Ability to retrieve a form through JS
  • Ability to create a basic version of the form without required elements
  • Rewrite JavaScript
  • Ability to set the additional required JS to include as a form method/property
  • Form checking (as you go)

Actions (+ Actionee)

  • We need to replace quickforms
  • Audit of all forms
    • Look for fields which aren’t really required