how can I add an textarea custom field? I added a custom field but it shows up on the report as a regular text field only. I want to change this to a textarea field.
Thanks in advance,
JT
Custom Field - textarea
Moderators: Developer, Contributor
Textarea
Hi,
in constant_inc.php you should add a line like
define( 'CUSTOM_FIELD_TYPE_TEXTAREA', 9 ); in section "# Custom Field types"
Next in strings_english.txt you find a line for the custom field strings. You should edit it this way:
$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:Email,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Textarea';
The same in config_defaults_inc.php. Find "$g_custom_field_type_enum_string" and set the value to
= '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:textarea';
In custom_field_api.php in function print_custom_field_input add
case CUSTOM_FIELD_TYPE_TEXTAREA:
echo '<textarea cols="80" rows="10" name="custom_field_' . $t_id . '" wrap="virtual"';
if( 0 < $p_field_def['length_max'] ) {
echo ' maxlength="' . $p_field_def['length_max'] . '"';
} else {
echo ' maxlength="255"';
}
echo '>' . $t_custom_field_value .'</textarea>';
break ;
before the last "case" inside this function.
These modifications worked for me. Hope this suits your needs!
Regards
Patrick
in constant_inc.php you should add a line like
define( 'CUSTOM_FIELD_TYPE_TEXTAREA', 9 ); in section "# Custom Field types"
Next in strings_english.txt you find a line for the custom field strings. You should edit it this way:
$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:Email,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Textarea';
The same in config_defaults_inc.php. Find "$g_custom_field_type_enum_string" and set the value to
= '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:textarea';
In custom_field_api.php in function print_custom_field_input add
case CUSTOM_FIELD_TYPE_TEXTAREA:
echo '<textarea cols="80" rows="10" name="custom_field_' . $t_id . '" wrap="virtual"';
if( 0 < $p_field_def['length_max'] ) {
echo ' maxlength="' . $p_field_def['length_max'] . '"';
} else {
echo ' maxlength="255"';
}
echo '>' . $t_custom_field_value .'</textarea>';
break ;
before the last "case" inside this function.
These modifications worked for me. Hope this suits your needs!
Regards
Patrick
Re: Custom Field - textarea
I have tried it with version 1.2, but does not work,
you could add a custom field textarea to version 1.2?
you could add a custom field textarea to version 1.2?
Re: Custom Field - textarea
For your information, I've shared a backport of the Mantis 1.3.x implementation of this feature for Mantis 1.2.3. The file is attached to the issue [issue]6626[/issue]
Re: Custom Field - textarea
Maybe a good decision, who knows when 1.3 will be out.
I didn't have a closer look. I hope there will be no conflict when updating 1.2.3 with your patch applied to 1.2.x or 1.3.0 because there where already database schema changes in 1.3
The upgrade procedure might get problems with database version in config table.
I didn't have a closer look. I hope there will be no conflict when updating 1.2.3 with your patch applied to 1.2.x or 1.3.0 because there where already database schema changes in 1.3
The upgrade procedure might get problems with database version in config table.