Project

General

Profile

Actions

Feature #22026

open

Conditional custom fields

Added by Anh Le Giang almost 9 years ago. Updated over 2 years ago.

Status:
New
Priority:
High
Assignee:
-
Category:
Custom fields
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

Like the very old topic below, I'd like to request "Conditional custom fields" feature for Redmine custom field, especially Issue object type.
conditional custom fields?

Example: Since we are mobile game developer, we have Device OS field which is a select custom field with value: Android, iOS, Windows Phone. And we have the sub fields OS version (Or even some fields like: Android version, iOS version and Windows Phone version). When reporter selects Android, the OS version field will be enable (show) with a list of version (could be text field or select field): 5.0, 5.1, 6.0, 4.4, etc.
Ref:
https://d1eipm3vz40hy0.cloudfront.net/images/p-apps-marketplace/apps/19078/screenshot-1.png
https://www.zendesk.com/apps/conditional-fields/

Thanks.


Files

Captura de tela 2021-01-11 112113.png (27.1 KB) Captura de tela 2021-01-11 112113.png BEFORE PLUGIN Roberto Mendes, 2021-01-11 15:41
Captura de tela 2021-01-11 111951.png (12.6 KB) Captura de tela 2021-01-11 111951.png AFTER PLUGIN Roberto Mendes, 2021-01-11 15:41

Related issues

Related to Redmine - Feature #6717: Custom list field with dynamic list contentNew2010-10-21

Actions
Related to Redmine - Feature #9734: Custom field , value list from database queryNew

Actions
Related to Redmine - Feature #13143: Populate dropdown custom field list based on previous another selection New

Actions
Related to Redmine - Feature #22621: Linked/conditional custom fieldsClosed

Actions
Related to Redmine - Feature #32178: Conditioned Custom FieldsNew

Actions
Actions #1

Updated by Toshi MARUYAMA almost 9 years ago

  • Description updated (diff)
Actions #2

Updated by Toshi MARUYAMA almost 9 years ago

  • Description updated (diff)
Actions #3

Updated by Hide MATSUTANI almost 9 years ago

+1

Actions #4

Updated by Hide MATSUTANI over 8 years ago

Let me introduce that redmine-view-customize plugin could help the requirement.
Please refer to the following blog. (Japanese site)

http://blog.enjoyxstudy.com/entry/2016/04/03/000000

Actions #5

Updated by Anh Le Giang over 8 years ago

Hide MATSUTANI wrote:

Let me introduce that redmine-view-customize plugin could help the requirement.
Please refer to the following blog. (Japanese site)

http://blog.enjoyxstudy.com/entry/2016/04/03/000000

Could you please update English?

Actions #6

Updated by Hide MATSUTANI over 8 years ago

Okay, I'll try...

Conditional custom fields can be made by following procedure.

(1) Pre-condition
Custom Fileds cf_1 and cf_2 are defined in your Redmine.
Value lists are defined like follows.
Say, cf_1 is a parent and cf_2 is a child.

  • cf_1
    • A
    • B
  • cf_2
    • A-1
    • A-2
    • B-1
    • B-2

You will know the parentFieldId and the childFieldId when you check the html source code.

(2) Install redmine-view-customize plugin

cd {RAILS_ROOT}/plugins
git clone https://github.com/onozaty/redmine-view-customize.git view_customize
cd ../
rake redmine:plugins:migrate RAILS_ENV=production

Note that the target directory name is different from the repository name.

When you finish installing, you can find 'view customize' in your Administration menu.

(3) Select 'view customize', then create 'New view customize' and set as follows:
Type

JavaScript

Path Pattern
/issues/

Code
$(function() {

  // Note that you should change these IDs according to your environment.
  var parentFieldId = 'issue_custom_field_values_1';
  var childFieldId = 'issue_custom_field_values_2';

  // define Conditions
  var isTarget = function(child, parent) {
    // This is a left-hand match sample
    return child.text().indexOf(parent.text()) == 0;
  }

  var narrowChildField = function() {

    var parentSelected = $('#' + parentFieldId + ' > option:selected');

    $('#' + childFieldId + ' > option').each(function() {

      var child = $(this);

      if (isTarget(child, parentSelected)) {
        child.show();
      } else {
        child.hide();
      }
    });
  }

  narrowChildField();

  $('#all_attributes').change(function(e) {
    if (e.target.id == parentFieldId) {
      narrowChildField();
    }
  });

  var _replaceIssueFormWith = replaceIssueFormWith;
  replaceIssueFormWith = function(html){

    _replaceIssueFormWith(html);

    narrowChildField();
  };
});

Then you can get the conditional custom fields.
When you select in the parent as 'A', you can only select 'A-1' or 'A-2' in the child field.

Is this clear?

Original information:
http://blog.enjoyxstudy.com/entry/2016/04/03/000000
https://github.com/onozaty/redmine-view-customize

Actions #7

Updated by Dipan Mehta over 8 years ago

The case listed in the description is indeed very relevant. However, in my view - the most simple yet generic way you can get this done well is to implement feature #6717 and related #9734. You can have list of possible values as a dynamic set based on some other field value. There are many issues related to #6717 which are similar to this one.

Do add related #6717, #9734, #13143.

Actions #8

Updated by Hide MATSUTANI over 8 years ago

Dipan Mehta wrote:

The case listed in the description is indeed very relevant. However, in my view - the most simple yet generic way you can get this done well is to implement feature #6717 and related #9734. You can have list of possible values as a dynamic set based on some other field value. There are many issues related to #6717 which are similar to this one.

Do add related #6717, #9734, #13143.

#13143 is the same as #22026. Actually these issues can be merged. My previous post could be a provisional way to achieve the purpose until this feature is formally implemented.
#6717, #9734 are similar to this from a user point of view, but I think they are different because #22026,#13143 actually use a client-side technology, whereas #6717, #9734 are server-side technology.

I feel the client-side technology is better because it should be responsive -- as it is discussed in the #22026
http://railscasts.com/episodes/88-dynamic-select-menus

Actions #9

Updated by Toshi MARUYAMA over 8 years ago

  • Related to Feature #6717: Custom list field with dynamic list content added
Actions #10

Updated by Toshi MARUYAMA over 8 years ago

  • Related to Feature #9734: Custom field , value list from database query added
Actions #11

Updated by Toshi MARUYAMA over 8 years ago

  • Related to Feature #13143: Populate dropdown custom field list based on previous another selection added
Actions #12

Updated by Toshi MARUYAMA over 8 years ago

Actions #13

Updated by Stephane Evr about 8 years ago

+1

Actions #14

Updated by Sonia Zh about 8 years ago

+1

Actions #15

Updated by Nova Pun about 8 years ago

Where can i find the custom_field_id ? I try to use "3" and "4" from address:

"http://ils.rainbowconcept.com:3000/custom_fields/3/edit" "http://ils.rainbowconcept.com:3000/custom_fields/4/edit"

, but it's no work ! thanks !

Actions #16

Updated by Roberto Tavares over 7 years ago

Hello!

Is it possible to customize project custom fields the same way as issues custom fields? Than I use "/projects/" in the "Path Pattern" field in the plugin... but besides this, where I have to adapt the code?

Thanks a lot!

Hide MATSUTANI wrote:

Okay, I'll try...

Conditional custom fields can be made by following procedure.

(1) Pre-condition
Custom Fileds cf_1 and cf_2 are defined in your Redmine.
Value lists are defined like follows.
Say, cf_1 is a parent and cf_2 is a child.

  • cf_1
    • A
    • B
  • cf_2
    • A-1
    • A-2
    • B-1
    • B-2

You will know the parentFieldId and the childFieldId when you check the html source code.

(2) Install redmine-view-customize plugin

[...]
Note that the target directory name is different from the repository name.

When you finish installing, you can find 'view customize' in your Administration menu.

(3) Select 'view customize', then create 'New view customize' and set as follows:
Type
[...]
Path Pattern
[...]
Code
[...]

Then you can get the conditional custom fields.
When you select in the parent as 'A', you can only select 'A-1' or 'A-2' in the child field.

Is this clear?

Original information:
http://blog.enjoyxstudy.com/entry/2016/04/03/000000
https://github.com/onozaty/redmine-view-customize

Actions #17

Updated by 膺升 陳 over 7 years ago

Hi all,

We got a problem as below,
After installing the plug-in,we can see "view customize" in Administrator menu,it is fine.
And then we just follow the steps as MATSUTANI mentioned,seems like it cannot work normally.
When we select parent as "A",not only "A-1","A-2" can be selected but also "B-1" and "B-2".
Could anyone give us a favor?Thanks in advanced.

Hide MATSUTANI wrote:

Okay, I'll try...

Conditional custom fields can be made by following procedure.

(1) Pre-condition
Custom Fileds cf_1 and cf_2 are defined in your Redmine.
Value lists are defined like follows.
Say, cf_1 is a parent and cf_2 is a child.

  • cf_1
    • A
    • B
  • cf_2
    • A-1
    • A-2
    • B-1
    • B-2

You will know the parentFieldId and the childFieldId when you check the html source code.

(2) Install redmine-view-customize plugin

[...]
Note that the target directory name is different from the repository name.

When you finish installing, you can find 'view customize' in your Administration menu.

(3) Select 'view customize', then create 'New view customize' and set as follows:
Type
[...]
Path Pattern
[...]
Code
[...]

Then you can get the conditional custom fields.
When you select in the parent as 'A', you can only select 'A-1' or 'A-2' in the child field.

Is this clear?

Original information:
http://blog.enjoyxstudy.com/entry/2016/04/03/000000
https://github.com/onozaty/redmine-view-customize

Actions #18

Updated by chris k over 7 years ago

Hi,

only for custom fields it works??? Thnx

Hide MATSUTANI wrote:

Okay, I'll try...

Conditional custom fields can be made by following procedure.

(1) Pre-condition
Custom Fileds cf_1 and cf_2 are defined in your Redmine.
Value lists are defined like follows.
Say, cf_1 is a parent and cf_2 is a child.

  • cf_1
    • A
    • B
  • cf_2
    • A-1
    • A-2
    • B-1
    • B-2

You will know the parentFieldId and the childFieldId when you check the html source code.

(2) Install redmine-view-customize plugin

[...]
Note that the target directory name is different from the repository name.

When you finish installing, you can find 'view customize' in your Administration menu.

(3) Select 'view customize', then create 'New view customize' and set as follows:
Type
[...]
Path Pattern
[...]
Code
[...]

Then you can get the conditional custom fields.
When you select in the parent as 'A', you can only select 'A-1' or 'A-2' in the child field.

Is this clear?

Original information:
http://blog.enjoyxstudy.com/entry/2016/04/03/000000
https://github.com/onozaty/redmine-view-customize

Actions #19

Updated by Aleksandar Pavic about 7 years ago

+1 for this feature.

Conditional custom fields (maybe per issue category), or have some different parent-child relation for custom fields.

Actions #20

Updated by Darwin Pou over 6 years ago

+1 for this feature. For example, I would like to look for in my customers database or Rest Webapi in order fill read-only text fields.
i.e.

Document Type: Hard List. Legal Id, Personal Document Id, etc.
Document: 00112760122
My webapi could return Name, LastName and use Redmine to complete this information in the form.

Actions #21

Updated by Fer nando over 5 years ago

Is there any progress on the Father-Son fields?

Actions #22

Updated by Bernhard Rohloff about 5 years ago

Actions #23

Updated by Stefan Lindner about 4 years ago

+1

Actions #24

Updated by Roberto Mendes almost 4 years ago

Working Perfectly!!! Thanks a lot!!!! \o/

Actions #27

Updated by Roberto Mendes almost 4 years ago

Thanks MATSUTANI!!!

Hide MATSUTANI wrote:

Okay, I'll try...

Conditional custom fields can be made by following procedure.

(1) Pre-condition
Custom Fileds cf_1 and cf_2 are defined in your Redmine.
Value lists are defined like follows.
Say, cf_1 is a parent and cf_2 is a child.

  • cf_1
    • A
    • B
  • cf_2
    • A-1
    • A-2
    • B-1
    • B-2

You will know the parentFieldId and the childFieldId when you check the html source code.

(2) Install redmine-view-customize plugin

[...]
Note that the target directory name is different from the repository name.

When you finish installing, you can find 'view customize' in your Administration menu.

(3) Select 'view customize', then create 'New view customize' and set as follows:
Type
[...]
Path Pattern
[...]
Code
[...]

Then you can get the conditional custom fields.
When you select in the parent as 'A', you can only select 'A-1' or 'A-2' in the child field.

Is this clear?

Original information:
http://blog.enjoyxstudy.com/entry/2016/04/03/000000
https://github.com/onozaty/redmine-view-customize

Actions #28

Updated by Alexandr Chernyaev over 3 years ago

+1

Actions

Also available in: Atom PDF