From cc4b83d882488ef741390151bacefe3fcfa6b630 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel
Date: Tue, 7 Apr 2009 07:40:40 +0200 Subject: [PATCH] Fix handling required and locked attributes. --- koward/lib/Form/Object.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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])) { -- 2.11.0