diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index b49cca3a1bd3df232383edd9f3f84df33954083a..206db1ef9a537f6be420ee55175f265208048cc7 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -330,7 +330,10 @@ class DynamicFormField extends VerySimpleModel { array($this->getField(), $what), $args); } - function getField() { + function getField($cache=true) { + if (!$cache) + return new FormField($this->ht); + if (!isset($this->_field)) $this->_field = new FormField($this->ht); return $this->_field; diff --git a/include/staff/dynamic-form.inc.php b/include/staff/dynamic-form.inc.php index b1d121e4ca028fd35b5188caf1e4fa8029af63b6..bf26fa1ef993a7122867a05cfcdb714e58b698a0 100644 --- a/include/staff/dynamic-form.inc.php +++ b/include/staff/dynamic-form.inc.php @@ -154,7 +154,11 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); $('#field-config').show(); return false; "><i class="icon-edit"></i> Config</a> - <?php } ?></td> + <?php } ?> + <div class="error" style="white-space:normal"><?php + if ($ferrors['type']) echo $ferrors['type']; + ?></div> + </td> <td><input type="checkbox" name="private-<?php echo $id; ?>" <?php if ($f->get('private')) echo 'checked="checked"'; ?> <?php echo $force_privacy ?>/></td> diff --git a/scp/forms.php b/scp/forms.php index d739a99043e5d6e384866e754b326176742d446f..567054c607d8941b35aabc128d840a8c5f63fb35 100644 --- a/scp/forms.php +++ b/scp/forms.php @@ -46,6 +46,13 @@ if($_POST) { $field->addError('Field variable name is not unique', 'name'); if (preg_match('/[.{}\'"`; ]/u', $field->get('name'))) $field->addError('Invalid character in variable name. Please use letters and numbers only.', 'name'); + // Subject (Issue Summary) must always have data + if ($form->get('type') == 'T' && $field->get('name') == 'subject') { + if (($f = $field->getField(false)->getImpl()) && !$f->hasData()) + $field->addError('The issue summary must be a field ' + .'that supports user input, such as short answer', + 'type'); + } if ($field->get('name')) $names[] = $field->get('name'); if ($field->isValid())