Removing Required Fields
Moderators: Developer, Contributor
Removing Required Fields
Hi all,
I'm working on a project to adapt the Mantis sytem for another purpose, completely different to bug tracking but using similar life cycle processes.
I have created a variety of custom fields and have ammended the HTML code to remove those parts that I do not need displayed. However as some fields are deemed "required" fields by default this causes problems on record submission.
Is it possible to adjust the status of required fields? If so where can this be done?
Many thanks
Steve
I'm working on a project to adapt the Mantis sytem for another purpose, completely different to bug tracking but using similar life cycle processes.
I have created a variety of custom fields and have ammended the HTML code to remove those parts that I do not need displayed. However as some fields are deemed "required" fields by default this causes problems on record submission.
Is it possible to adjust the status of required fields? If so where can this be done?
Many thanks
Steve
This can be done by changing bug_report.php. You will need to change the line that gets the required field as follows:
$f_required_field = gpc_get_string('required_field');
to
$f_required_field = gpc_get_string('required_field', 'default value');
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect
$f_required_field = gpc_get_string('required_field');
to
$f_required_field = gpc_get_string('required_field', 'default value');
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect
Steve:
In bug_report.php near the top of the page you'll see a line that reads:
$t_bug_data = new BugData;
Then after that, there's the various functions that are called to populate various fields in the $t_bug_data object. The assignments here that have a second parameter in the gpc_get_* functions are considered optional.
Assume, for example, that you want to make the 'summary' field optional.
There's a line there that reads:
$t_bug_data->summary = gpc_get_string( 'summary' );
You need to replace that line with:
$t_bug_data->summary = gpc_get_string( 'summary', '' );
to make the field optional.
If you still have problems, feel free to hop on IRC and ask there...
Hope this helps,
Lincoln.
In bug_report.php near the top of the page you'll see a line that reads:
$t_bug_data = new BugData;
Then after that, there's the various functions that are called to populate various fields in the $t_bug_data object. The assignments here that have a second parameter in the gpc_get_* functions are considered optional.
Assume, for example, that you want to make the 'summary' field optional.
There's a line there that reads:
$t_bug_data->summary = gpc_get_string( 'summary' );
You need to replace that line with:
$t_bug_data->summary = gpc_get_string( 'summary', '' );
to make the field optional.
If you still have problems, feel free to hop on IRC and ask there...
Hope this helps,
Lincoln.
This is very strange, that's what I've been ammending.
I'm having trouble with the line:
$t_bug_data->description = gpc_get_string( 'description', '' );
This has been ammended as you suggest but on "submittal" I still get an error saying the field has not been completed.
I'm afraid I cant get access to IRC from here, ports are blocked by office firewall - any suggestions on a good IRC web based client?
I'm having trouble with the line:
$t_bug_data->description = gpc_get_string( 'description', '' );
This has been ammended as you suggest but on "submittal" I still get an error saying the field has not been completed.
I'm afraid I cant get access to IRC from here, ports are blocked by office firewall - any suggestions on a good IRC web based client?
Summary and description are mandatory fields. This is enforced in core/bug_api.php. You can get arround this problem by defaulting the description to 'none' or to the same value as summary (in case it is empty).
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect
Regards,
Victor
MantisConnect
http://www.futureware.biz/mantisconnect
Option 1: Default description to none.
Option 2: Default description to summary.
Regards,
Victor
Mantis Blog
http://www.futureware.biz/
Code: Select all
$t_bug_data->description = gpc_get_string( 'description', 'none' );
Code: Select all
$t_bug_data->description = gpc_get_string( 'description', '' );
if ( is_blank( $t_bug_data->description ) ) {
$t_bug_data->description = $t_bug_data->summary;
}
Victor
Mantis Blog
http://www.futureware.biz/
Mandatory Fields per Project
Hello,
can I do this also per project?
I think I understood the above.
I want to have summary an subject not mandatory only for one specific project. Is that possible?
Thx in advance
Andreas
Sorry forgot: Mantis Version is 1.0.1
can I do this also per project?
I think I understood the above.
I want to have summary an subject not mandatory only for one specific project. Is that possible?
Thx in advance
Andreas
Sorry forgot: Mantis Version is 1.0.1
Re: Removing Required Fields
Hello,
I am also facing same problem, i want to remove mandatory fields, but i can't able to do that
i have tried below mentioned statements in bug_report.php
$t_bug_data->description = gpc_get_string( 'description', 'none' );
or
$t_bug_data->description = gpc_get_string( 'description', '' );
even i tried to update in config_inc.php,
But none of the above worked for me
i am using mantis version 1.3.1
can any one suggest me what to do ?
Thanks & Regards,
Ankit Raj
I am also facing same problem, i want to remove mandatory fields, but i can't able to do that
i have tried below mentioned statements in bug_report.php
$t_bug_data->description = gpc_get_string( 'description', 'none' );
or
$t_bug_data->description = gpc_get_string( 'description', '' );
even i tried to update in config_inc.php,
But none of the above worked for me
i am using mantis version 1.3.1
can any one suggest me what to do ?
Thanks & Regards,
Ankit Raj
Re: Removing Required Fields
I am also in a situation where i couldn't remove any of the fields that i wanted to remove from the 'report issue ' page..can someone help me?
Much appreciated
Much appreciated
Re: Removing Required Fields
Please don't go this complex.You can take a look on below post of mine.
http://www.mantisbt.org/forums/viewtopi ... =4&t=24913
http://www.mantisbt.org/forums/viewtopi ... =4&t=24913