[Pieforms-commit] SF.net SVN: pieforms: [163] pieforms-php5/trunk/src/pieform.php
Status: Alpha
Brought to you by:
oracleshinoda
From: <ora...@us...> - 2007-01-07 21:06:04
|
Revision: 163 http://svn.sourceforge.net/pieforms/?rev=163&view=rev Author: oracleshinoda Date: 2007-01-07 13:05:58 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Added support for calling a global validation function pieform_validate for every form. Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2007-01-07 20:40:21 UTC (rev 162) +++ pieforms-php5/trunk/src/pieform.php 2007-01-07 21:05:58 UTC (rev 163) @@ -499,11 +499,6 @@ $values = $this->get_submitted_values(); // Perform general validation first $this->validate($values); - // Then user specific validation if a function is available for that - $function = $this->data['validatecallback']; - if (is_callable($function)) { - call_user_func_array($function, array($this, $values)); - } // Submit the form if things went OK if ($this->data['submit'] && !$this->has_errors()) { @@ -805,6 +800,12 @@ * @param array $values The submitted values from the form */ private function validate($values) { + // Call the overall validation function if it is available + if (function_exists('pieform_validate')) { + pieform_validate($this, $values); + } + + // Perform rule validation foreach ($this->get_elements() as $element) { if (isset($element['rules']) && is_array($element['rules'])) { foreach ($element['rules'] as $rule => $data) { @@ -829,6 +830,12 @@ } } } + + // Then user specific validation if a function is available for that + $function = $this->data['validatecallback']; + if (is_callable($function)) { + call_user_func_array($function, array($this, $values)); + } } private function whichbutton_js() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |