customize a dynamic custom filed

Get help from other users here.

Moderators: Developer, Contributor

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

customize a dynamic custom filed

Post 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
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: customize a dynamic custom filed

Post 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
Please use Search before posting and read the Manual
Amin
Posts: 26
Joined: 08 Oct 2018, 15:42

Re: customize a dynamic custom filed

Post by Amin »

Thank you Atrol,

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

Thank you
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: customize a dynamic custom filed

Post 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
Please use Search before posting and read the Manual
Amin
Posts: 26
Joined: 08 Oct 2018, 15:42

Re: customize a dynamic custom filed

Post by Amin »

Undertand, thank you :) I' appreciateyour help.
Post Reply