[Pieforms-commit] SF.net SVN: pieforms: [73] pieforms-php5/trunk/src
Status: Alpha
Brought to you by:
oracleshinoda
From: <ora...@us...> - 2006-11-29 02:55:14
|
Revision: 73 http://svn.sourceforge.net/pieforms/?rev=73&view=rev Author: oracleshinoda Date: 2006-11-28 18:55:14 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Fix up obvious fuckups, remove restriction on needing to define the default submit function 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:22:36 UTC (rev 72) +++ pieforms-php5/trunk/src/pieform/elements/submitcancel.php 2006-11-29 02:55:14 UTC (rev 73) @@ -42,8 +42,6 @@ } 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:22:36 UTC (rev 72) +++ pieforms-php5/trunk/src/pieform.php 2006-11-29 02:55:14 UTC (rev 73) @@ -556,17 +556,19 @@ // Submit the form if things went OK if ($this->submit && !$this->has_errors()) { + $submitted = false; foreach ($this->get_elements() as $element) { // @todo Rename 'ajaxmessages' to 'submitelement' - if ($element['ajaxmessages'] == true && isset($values[$element['name']])) { + if (!empty($element['ajaxmessages']) == true && isset($values[$element['name']])) { $function = "{$this->name}_submit_{$element['name']}"; if (function_exists($function)) { $function($values); + $submitted = true; break; } } } - else if (function_exists($this->submitfunction)) { + if (!$submitted && 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 @@ -582,7 +584,7 @@ //} //throw new PieformException($message); } - else { + else if (!$submitted) { throw new PieformException('No function registered to handle form submission for form "' . $this->name . '"'); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |