diff --git a/src/Pluf/Form.php b/src/Pluf/Form.php index bff8e4a..4a8cf3d 100644 --- a/src/Pluf/Form.php +++ b/src/Pluf/Form.php @@ -137,6 +137,7 @@ class Pluf_Form implements Iterator return true; } // as some errors, we do not have cleaned data available. + $this->failed(); $this->cleaned_data = array(); $this->is_valid = false; return false; @@ -156,6 +157,17 @@ class Pluf_Form implements Iterator } /** + * Method just called after the validation if the validation + * failed. This can be used to remove uploaded + * files. $this->['cleaned_data'] will be available but of course + * not fully populated and with possible garbage due to the error. + * + */ + public function failed() + { + } + + /** * Get initial data for a given field. * * @param string Field name.