Difference between revisions of "Developer Area/Core Subsystems/Form API (Pieforms)/Page Title"

From Mahara Wiki
Jump to navigation Jump to search
(Created page with "<div class="wikitext"><div id="section_1"> === AJAX forms === ; Are now sent via a hidden iframe instead of a <span class="wikiunknown"><u>MochiKit</u>[http://old.eduforge.org/…")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<div class="wikitext"><div id="section_1">
 
<div class="wikitext"><div id="section_1">
  
=== AJAX forms ===
+
===AJAX forms===
  
 
; Are now sent via a hidden iframe instead of a <span class="wikiunknown"><u>MochiKit</u>[http://old.eduforge.org/wiki/wiki/mahara/wiki?pagename=MochiKit&action=create ?]</span> JSONDoc call. This means
 
; Are now sent via a hidden iframe instead of a <span class="wikiunknown"><u>MochiKit</u>[http://old.eduforge.org/wiki/wiki/mahara/wiki?pagename=MochiKit&action=create ?]</span> JSONDoc call. This means
Line 15: Line 15:
 
</div><div id="section_2">
 
</div><div id="section_2">
  
=== Pieform class API changes ===
+
===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')
 
Most of the get_* methods are gone, replaced with get_property('propname') - for example, get_method is now get_property('method')
Line 21: Line 21:
 
</div><div id="section_3">
 
</div><div id="section_3">
  
=== Element API changes ===
+
===Element API changes===
  
 
All element functions are now named pieform_element_*
 
All element functions are now named pieform_element_*
Line 35: Line 35:
 
</div><div id="section_4">
 
</div><div id="section_4">
  
=== i18n ===
+
===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.
 
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.
Line 41: Line 41:
 
</div><div id="section_5">
 
</div><div id="section_5">
  
=== Rules ===
+
===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'.
 
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'.
Line 47: Line 47:
 
</div><div id="section_6">
 
</div><div id="section_6">
  
=== Fixes ===
+
===Fixes===
  
 
* Tabindex fixed for calendar and date elements
 
* Tabindex fixed for calendar and date elements
Line 58: Line 58:
 
</div><div id="section_7">
 
</div><div id="section_7">
  
=== Enhancements ===
+
===Enhancements===
  
 
Fieldsets can be collapsed Textareas can be resized
 
Fieldsets can be collapsed Textareas can be resized
  
 
</div></div>
 
</div></div>

Latest revision as of 17:14, 12 May 2011

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