* docs/changes.txt: Merged
* includes/functions.php:
(construct_custom_fields): Required select fields do not get a blank option
* templates/bugfield_select_single.tpl: Need to convert to BSTemplate
* templates/bugfield_select_single_option.tpl: ditto
Cherry-pick
88054e0ab0837f09cfc740369d6469e9816a3d6c
1.2.3
===============================
-- Fixed: Custom select field that is mandatory doesn't accept the first option as a valid entry (bug://report/121)
+- Fixed: #121: Custom select field that is mandatory doesn't accept the first option as a valid entry
+- Fixed: Improved XHTML compliance in various templates
+- Fixed: #134: Column headers (defined in includes/definitions.php) were not marked with T() for translation
+- Change: Required custom select fields will no longer show the empty option (these fields could not be saved as empty, though, because they wouldn't validate -- this is purely an interface change)
1.2.2
===============================
case 'select_single':
$selects = unserialize($field['selects']);
$value = trim($value);
+ $options = '';
- $tpl = new BSTemplate('bugfield_select_single_option');
- $tpl->vars = array(
- 'id' => -1,
- 'select' => '',
- 'selected' => ((!$field['usedefault'] && !trim($value)) ? ' selected="selected"' : '')
- );
- $options = $tpl->evaluate()->getTemplate();
+ // this overrides $field['usedefault'] because required fields will no longer have
+ // blank values as options
+ // TODO document above comment in the ACP
+ if (!$field['required'])
+ {
+ $tpl = new BSTemplate('bugfield_select_single_option');
+ $tpl->vars = array(
+ 'id' => -1,
+ 'select' => '',
+ 'selected' => ((!$field['usedefault'] && !trim($value)) ? ' selected="selected"' : '')
+ );
+ $options = $tpl->evaluate()->getTemplate();
+ }
foreach ($selects as $id => $select)
{
<!-- custom field<%- $field['fieldid'] %> -->
<fieldset>
- <legend><%- $field['name'] %> <%- $help['field' . $field['fieldid']] %></legend>
+ <legend><%- $field['name'] %> help[field<%- $field['fieldid'] %>]</legend>
<div class="field"><select name="custom<%- $field['fieldid'] %>"><%- $options %></select></div>
</fieldset>
<!-- / custom field<%- $field['fieldid'] %> -->
\ No newline at end of file
-<option value="$id"$selected>$select</option>
\ No newline at end of file
+<option value="<%- $id %>"<%- $selected %>><%- $select %></option>
\ No newline at end of file