Developer Area/Core Subsystems/Form API (Pieforms)/Page Title

From Mahara Wiki
Jump to: navigation, search

AJAX forms

Are now sent via a hidden iframe instead of a MochiKit? JSONDoc call. This means
 :* Files can be sent via js - any number of files per form
  • There's no need for the pieform_get_value_js_* functions anymore - the form is simply retargeted to the iframe so the browser does it automatically.

Are now enabled with 'jsform', NOT 'ajaxpost' (renamed as it can be sent by GET or POST, and isn't AJAX anymore).

ajaxsuccessfunction and ajaxfailurefunction have been renamed to jssuccesscallback and jserrorcallback for consistency

You can cancel from a js form.

Pieform class API changes

Most of the get_* methods are gone, replaced with get_property('propname') - for example, get_method is now get_property('method')

Element API changes

All element functions are now named pieform_element_*

So pieform_render_* becomes pieform_element_* pieform_get_value_* becomes pieform_element_*_get_value

Checkboxes now use 'defaultvalue' instead of 'checked' to signal whether they are on or off.

All functions that need the Pieform object now take it as their first argument! This is a very large change, but makes things a lot more consistent.

'ajaxmessages' flag has been renamed to 'submitelement', as that's more descriptive

i18n

Now each element, renderer and rule can define their own i18n strings. Individual elements in a form can set the 'rulei18n' index to customise the i18n string for their own rules, and forms can set the 'rule18n' index to pass in defaults for the whole form. Because of the last one, pieform_configure can be used to pass default strings to all forms.

Rules

Now each element can define a function that describes how a rule applies to it. This is useful for, say, the WYSIWYG element: we can say that trim(strip_tags($value)) is the test for 'required'.

Fixes

  • Tabindex fixed for calendar and date elements
  • Hopefully now checkboxes are not completely retarded in their behaviour when form is/is not submitted
  • Select elements won't die horribly if they have no options
  • All submit type element send their values through only when submitted, without actually killing the value when they are displayed
  • Table renderer sets 'error' class on elements correctly when an error occurs on AJAX post, and removes it again if the element no longer has an error on it.
  • You can now have a presubmit function for a non js form

Enhancements

Fieldsets can be collapsed Textareas can be resized