customize a dynamic custom filed

Get help from other users here.

Moderators: Contributor, Developer

Post Reply
Amin
Posts: 26
Joined: Oct 08, 2018 10:42 am

customize a dynamic custom filed

Post by Amin » Oct 09, 2018 7:07 am

Hello,
First, thank you for your help.

I want to do this function

I have 2 custom field :
1 - "Country" with values "France, USA, England"
2 - "Town" which will have dynamically values

I want to do somehting when I select
- "France" you will have in the 2nd custom field list towns "Paris, Nantes, Lille" etc
- "USA" : "new york, washington, chicago" etc
- "England" : "London, Liverpool, manchester" etc

I know that I need to create a override function in custom_function_api.ph
and in this function I should propably use this 2 functions :

$p_field_id=custom_field_get_id_from_name('Country'); //get the id of custom field
$p_field_value=custom_field_get_value( $p_field_id, $t_issue_id ); // get the value selected

The problem is that I can't know the id of issue because the issues still not created. So the function custom_field_get_value dosen't work correctly.

Anyone have an idea ?

Thank you for you help

atrol
Site Admin
Posts: 7579
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: customize a dynamic custom filed

Post by atrol » Oct 09, 2018 7:16 am

You have to use JavaScript, as you have to implement it on client side.

This plugin (unfortunately not avalailble for latest Mantis) might help to get an understanding of how to implement it
https://www.mantisbt.org/wiki/doku.php/ ... stomfields
https://github.com/mantisbt-plugins/lin ... tom-fields
Please use Search before posting and read the Manual

Amin
Posts: 26
Joined: Oct 08, 2018 10:42 am

Re: customize a dynamic custom filed

Post by Amin » Oct 09, 2018 7:28 am

Thank you Atrol,

And where I need to implement it ? In custom_function_api.php ?

Thank you

atrol
Site Admin
Posts: 7579
Joined: Mar 26, 2008 4:37 pm
Location: Germany

Re: customize a dynamic custom filed

Post by atrol » Oct 09, 2018 8:32 am

You have to write a plugin, similar to the one that I linked to.

Check the "Developers Guide" for more details about writing plugins
https://www.mantisbt.org/docs/master/en ... ev.plugins
Please use Search before posting and read the Manual

Amin
Posts: 26
Joined: Oct 08, 2018 10:42 am

Re: customize a dynamic custom filed

Post by Amin » Oct 09, 2018 8:35 am

Undertand, thank you :) I' appreciateyour help.

Post Reply