Relationship Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004076 | mantisbt | custom fields | public | 2004-07-12 12:49 | 2014-11-07 15:24 |
| Reporter | derpommes | Assigned To | |||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | new | Resolution | open | ||
| Product Version | 0.18.2 | ||||
| Summary | 0004076: custom_field: maxsize + tabindex | ||||
| Description | I've made some customizations (on 0.18.2) but it looks like there isn't anything similar in 0.19.x ? 1.: set the size="x" value for HTML to the maxsize value of the custom field | ||||
| Tags | No tags attached. | ||||
| Attached Files | custom_field_api.php.part (1,958 bytes)
# --------------------
# Print an input field
# $p_field_def contains the definition of the custom field (including it's
# field id
# $p_bug_id contains the bug where this field belongs to. If it's left
# away, it'll default to 0 and thus belongs to a new (i.e.
# non-existant) bug
# $p_html_tabindex is the html tabindex to insert in the input field, or nothing if tabindex=-1
# NOTE: This probably belongs in the print_api.php
function print_custom_field_input( $p_field_def, $p_bug_id = null, $p_html_tabindex=-1 ) {
$html_tabindex = '';
if ($p_html_tabindex >= 0)
$html_tabindex = 'tabindex="' . $p_html_tabindex . '"';
$t_id = $p_field_def['id'];
if( null == $p_bug_id ) {
$t_custom_field_value = $p_field_def['default_value'];
} else {
$t_custom_field_value = custom_field_get_value( $t_id, $p_bug_id );
}
$t_custom_field_value = string_attribute( $t_custom_field_value );
switch ($p_field_def['type']) {
case CUSTOM_FIELD_TYPE_ENUM:
echo "<select name=\"custom_field_$t_id\" ". $html_tabindex .">";
$t_values = explode('|', $p_field_def['possible_values']);
foreach( $t_values as $t_option ) {
if( $t_custom_field_value == $t_option ) {
echo "<option value=\"$t_option\" selected>$t_option</option>";
} else {
echo "<option value=\"$t_option\">$t_option</option>";
}
}
echo '</select>';
break;
case CUSTOM_FIELD_TYPE_NUMERIC:
case CUSTOM_FIELD_TYPE_FLOAT:
case CUSTOM_FIELD_TYPE_EMAIL:
default:
case CUSTOM_FIELD_TYPE_STRING:
$maxlen = 255;
if( 0 < $p_field_def['length_max'] ) {
$maxlen = $p_field_def['length_max'];
}
echo "<input type=\"text\" name=\"custom_field_$t_id\" size=\"" . ($maxlen+1) . "\"";
echo ' maxlength="' . $maxlen .'"';
echo ' ' . $html_tabindex;
echo " value=\"$t_custom_field_value\"></input>";
}
}
| ||||
related to
child of
duplicate of