Shout: improve form validation logic
authorBen Klang <ben@alkaloid.net>
Tue, 9 Mar 2010 01:24:31 +0000 (20:24 -0500)
committerBen Klang <ben@alkaloid.net>
Tue, 9 Mar 2010 01:25:13 +0000 (20:25 -0500)
shout/extensions.php

index df3468e..ca72760 100644 (file)
@@ -26,12 +26,10 @@ switch ($action) {
 case 'add':
 case 'edit':
     $vars = Horde_Variables::getDefaultVariables();
-    $vars->set('account', $curaccount['code']);
+    $vars->set('account', $curaccount);
     $Form = new ExtensionDetailsForm($vars);
 
-    $FormValid = $Form->validate($vars, true);
-
-    if ($Form->isSubmitted() && $FormValid) {
+    if ($Form->isSubmitted() && $Form->validate($vars, true)) {
         // Form is Valid and Submitted
         try {
             $Form->execute();
@@ -54,7 +52,7 @@ case 'edit':
         $vars->set('oldextension', $extension);
     }
     $vars->set('action', $action);
-    $Form = new ExtensionDetailsForm($vars);
+    //$Form = new ExtensionDetailsForm($vars);
     // Make sure we get the right template below.
     $action = 'edit';