Moodle

formslib.php improvement

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8
  • Fix Version/s: 1.8
  • Component/s: Accessibility
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE

Description

patch following...

  1. formslibx.php
    11/Oct/06 3:13 PM
    13 kB
    Petr Škoda (skodak)
  2. ft.php
    11/Oct/06 3:12 PM
    2 kB
    Petr Škoda (skodak)
  3. ft2.php
    12/Oct/06 3:37 PM
    2 kB
    Petr Škoda (skodak)

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

Pending:

  • File uploading and sesskey protection not implemented.
  • Method names could be improved.
  • Some dummy validation callback method could be added.

Changes:

  • the outside API is not dependent on quickforms
  • non-post form type compatible with xxx_param() functions - both return the same data
  • easier to learn how to use - less methods in the wrapper
  • server-side Moodle specific cleaning
  • only form_definition() uses quickform methods, but only those related to form construction
Show
Petr Škoda (skodak) added a comment - Pending:
  • File uploading and sesskey protection not implemented.
  • Method names could be improved.
  • Some dummy validation callback method could be added.
Changes:
  • the outside API is not dependent on quickforms
  • non-post form type compatible with xxx_param() functions - both return the same data
  • easier to learn how to use - less methods in the wrapper
  • server-side Moodle specific cleaning
  • only form_definition() uses quickform methods, but only those related to form construction
Hide
Petr Škoda (skodak) added a comment -
  • one more change - form name is constructed from the class name
Show
Petr Škoda (skodak) added a comment -
  • one more change - form name is constructed from the class name
Hide
Jamie Pratt added a comment -

Following on from our skype chat I'm going to post a number of ideas here as they come up while examining your code Petr.

We should consider removing the target parameter in :

function moodleform_wrapper($action, $customdata=null, $method='post', $target='', $attributes=null) {

as target is deprecated in xhtml strict.

Show
Jamie Pratt added a comment - Following on from our skype chat I'm going to post a number of ideas here as they come up while examining your code Petr. We should consider removing the target parameter in : function moodleform_wrapper($action, $customdata=null, $method='post', $target='', $attributes=null) { as target is deprecated in xhtml strict.
Hide
Jamie Pratt added a comment -

use_values_as_defaults() method is redundant since the user input anyway always overrides qf's defaults.

Show
Jamie Pratt added a comment - use_values_as_defaults() method is redundant since the user input anyway always overrides qf's defaults.
Hide
Jamie Pratt added a comment -

Hi Petr,

I added this code to the end of your updateSubmission method and then use_values_as_defaults() really is redundant :

//need to tell elements that they need to update their value attribute.
foreach (array_keys($this->_elements) as $key) { $this->_elements[$key]->onQuickFormEvent('updateValue', null, $this); }

Jamie

Show
Jamie Pratt added a comment - Hi Petr, I added this code to the end of your updateSubmission method and then use_values_as_defaults() really is redundant : //need to tell elements that they need to update their value attribute. foreach (array_keys($this->_elements) as $key) { $this->_elements[$key]->onQuickFormEvent('updateValue', null, $this); } Jamie
Hide
Petr Škoda (skodak) added a comment -

The new formslib.php in in HEAD, attaching new form test file
I think the API should be stable now, but of course we can still rename the method names if needed.

I am working on course/edit3.php and incline docs+comments. in formslib.php today.

Show
Petr Škoda (skodak) added a comment - The new formslib.php in in HEAD, attaching new form test file I think the API should be stable now, but of course we can still rename the method names if needed. I am working on course/edit3.php and incline docs+comments. in formslib.php today.
Hide
Petr Škoda (skodak) added a comment -

all should be fixed in cvs, closing now

Show
Petr Škoda (skodak) added a comment - all should be fixed in cvs, closing now

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: