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
- Symfony [https://github.com/symfony/Form
- Drupal forms
- Reinvent the wheel
- From scratch (like database framework) => moodleforms2
- Or upgrade using Quickform2
- No, it is a dead end
- We don’t use Quickform elements, etc, we only use 10% of existing Quickform library. Quickform was mainly used as just a renderer
- But author of Quickform library wants to help ( https://moodle.org/mod/forum/discuss.php?d=200124 )
- Zend Framework forms ( http://framework.zend.com/manual/1.12/en/zend.form.html )
- List of possibilities: http://stackoverflow.com/questions/910708/html-form-library-for-php-5 (circa 2009-2011)
- How much work is it to integrate moodle with existing frameworks? (lang packs, editors, )
- 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