diff --git a/account.php b/account.php index 2e081c7354bc828faecc9839d494f0b28258990e..41c5a482fd9bcdf19e8c1dbc0c473d0da8e56e97 100644 --- a/account.php +++ b/account.php @@ -32,6 +32,7 @@ elseif ($thisclient) { foreach ($thisclient->getForms() as $f) if ($f->get('type') == 'U') $user_form = $f; + $user_form->getField('email')->configure('disabled', true); } // Existing client (with an account) updating profile else { diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 8c78c09b0cabfb1cfa563dd025e75350504b06ae..01682d00cf20c9f71976f7821a73076a98881f60 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -73,9 +73,9 @@ class DynamicForm extends VerySimpleModel { } function getField($name) { - foreach ($this->getDynamicFields() as $f) + foreach ($this->getFields() as $f) if (!strcasecmp($f->get('name'), $name)) - return $f->getImpl(); + return $f; } function hasField($name) { diff --git a/include/class.forms.php b/include/class.forms.php index 2bbb04a66559d7264816968e2ce023b9b271e083..7a43ddd961db2b3ba4a02483722420b739ed1564 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -478,6 +478,11 @@ class FormField { return $this->_cform; } + function configure($prop, $value) { + $this->getConfiguration(); + $this->_config[$prop] = $value; + } + function getWidget() { if (!static::$widget) throw new Exception('Widget not defined for this field'); @@ -960,12 +965,14 @@ class TextboxWidget extends Widget { $classes = 'class="'.$config['classes'].'"'; if (isset($config['autocomplete'])) $autocomplete = 'autocomplete="'.($config['autocomplete']?'on':'off').'"'; + if (isset($config['disabled'])) + $disabled = 'disabled="disabled"'; ?> <span style="display:inline-block"> <input type="<?php echo static::$input_type; ?>" id="<?php echo $this->name; ?>" - <?php echo $size . " " . $maxlength; ?> - <?php echo $classes.' '.$autocomplete + <?php echo implode(' ', array_filter(array( + $size, $maxlength, $classes, $autocomplete, $disabled))) .' placeholder="'.$config['placeholder'].'"'; ?> name="<?php echo $this->name; ?>" value="<?php echo Format::htmlchars($this->value); ?>"/>