I would like to request a clear_values function for the validation library. Often I find myself reloading the same form, instead of showing a success page, but if you do that, the form gets repopulated with submitted values. The values don’t get cleaned. I would suggest either cleaning the values automatically upon validation, or adding a separate function for it.
xwero wrote a little function for it that would make a good addition to the library I think.
function clear_values()
{
$fieldnames = array_keys($this->_rules);
foreach($fieldnames as $fieldname)
{
if(isset($this->$fieldname))
{
unset($this->$fieldname);
}
}
}
doing it automatically could happen in the run() function… Maybe add a variable: function run (clear_values = false) {}, and then add that function in an if statement…
