saveValuesErrorsReset to simplify the codes.
In views :
$form = new \form ();
$values = array ();
$errors = array ();
// If there is saved values, use them, else return the provided $values
$values = $form->getOldValues ($values);
$errors = $form->getOldErrors ($errors);
In index.php :
$form = new \form ();
$values = $form->values ();
$errors = $ipsetsObj->verify ($values);
$form->saveValuesErrors ($values, $errors);
if (count ($errors)) $route->redirect ("/ipsets/add");
$ipsetsObj->createSet ($values["setname"], $values["typename"]);
// If there is no error (catched by exception), clear the form for next
// time
$form->saveValuesErrorsReset ();
$route->redirect ("/ipsets", "");
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2697 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
32 KiB
32 KiB