[Pieforms-commit] SF.net SVN: pieforms: [72] pieforms-php5/trunk/src
Status: Alpha
Brought to you by:
oracleshinoda
From: <ora...@us...> - 2006-11-28 23:22:36
|
Revision: 72 http://svn.sourceforge.net/pieforms/?rev=72&view=rev Author: oracleshinoda Date: 2006-11-28 15:22:36 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Hopefully added support for different callbacks based on the name of the submit button pressed Modified Paths: -------------- pieforms-php5/trunk/src/pieform/elements/submitcancel.php pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform/elements/submitcancel.php =================================================================== --- pieforms-php5/trunk/src/pieform/elements/submitcancel.php 2006-11-28 23:14:35 UTC (rev 71) +++ pieforms-php5/trunk/src/pieform/elements/submitcancel.php 2006-11-28 23:22:36 UTC (rev 72) @@ -42,6 +42,8 @@ } function pieform_render_submitcancel_set_attributes($element) { + // @todo change to 'submitelement' => true, more generic and can be used + // for working out which submit button was pressed $element['ajaxmessages'] = true; return $element; } Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2006-11-28 23:14:35 UTC (rev 71) +++ pieforms-php5/trunk/src/pieform.php 2006-11-28 23:22:36 UTC (rev 72) @@ -556,7 +556,17 @@ // Submit the form if things went OK if ($this->submit && !$this->has_errors()) { - if (function_exists($this->submitfunction)) { + foreach ($this->get_elements() as $element) { + // @todo Rename 'ajaxmessages' to 'submitelement' + if ($element['ajaxmessages'] == true && isset($values[$element['name']])) { + $function = "{$this->name}_submit_{$element['name']}"; + if (function_exists($function)) { + $function($values); + break; + } + } + } + else if (function_exists($this->submitfunction)) { $function = $this->submitfunction; // Call the user defined function for processing a submit // This function should really redirect/exit after it has This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |