From: Gunnar Wrobel
Date: Tue, 7 Apr 2009 05:40:40 +0000 (+0200) Subject: Fix handling required and locked attributes. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=cc4b83d882488ef741390151bacefe3fcfa6b630;p=horde.git Fix handling required and locked attributes. --- diff --git a/koward/lib/Form/Object.php b/koward/lib/Form/Object.php index 2924335fa..7a43b843a 100644 --- a/koward/lib/Form/Object.php +++ b/koward/lib/Form/Object.php @@ -127,10 +127,15 @@ class Koward_Form_Object extends Horde_Form { $type = 'text'; } + $locked = in_array($key, $attribute_map['locked']) && !empty($this->object); + if (!$locked) { + $required = in_array($key, $attribute_map['required']) && empty($this->object); + } + $form_attributes[$key] = array( 'type' => $type, - 'required' => in_array($key, $attribute_map['required']), - 'readonly' => in_array($key, $attribute_map['locked']), + 'required' => $required, + 'readonly' => $locked, 'params' => array('regex' => '', 'size' => 40, 'maxlength' => 255) ); if (isset($config['attributes']['order'][$key])) {