Page 1 of 1

customize a dynamic custom filed

Posted: 09 Oct 2018, 12:07
by Amin
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

Re: customize a dynamic custom filed

Posted: 09 Oct 2018, 12:16
by atrol
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

Re: customize a dynamic custom filed

Posted: 09 Oct 2018, 12:28
by Amin
Thank you Atrol,

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

Thank you

Re: customize a dynamic custom filed

Posted: 09 Oct 2018, 13:32
by atrol
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

Re: customize a dynamic custom filed

Posted: 09 Oct 2018, 13:35
by Amin
Undertand, thank you :) I' appreciateyour help.