Hierarchical Dynamic Feild

Moderator: crythias

Locked
vishutux
Znuny newbie
Posts: 8
Joined: 09 Jun 2015, 06:42
Znuny Version: OTRS 4.0
Real Name: Vishesh
Company: Linuxmantra

Hierarchical Dynamic Feild

Post by vishutux »

Hi Members,

I am using OTRS 4.0. We created three dynamic field Category, SubCategory and Subcategory2 in our setup. The requirement is by default Subcategory and Subcategory field should be hidden and Subcategory field should appear if we select any value in Category field and similarly Subcategory2 field should appear if we select any value in Subcategory field.

Thanks
Vishesh
root
Administrator
Posts: 4253
Joined: 18 Dec 2007, 12:23
Znuny Version: Znuny and Znuny LTS
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: Hierarchical Dynamic Feild

Post by root »

There's no way to hide a dynamic field wo/ coding.
But you can use ACLs to achieve sth. like hierarchical/depending dynamic fields. Only values x,y,z in field 2 when value a choosen in field 1.
Regarding to your post, you'll need to develop (e.g. an output filter).
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?
vishutux
Znuny newbie
Posts: 8
Joined: 09 Jun 2015, 06:42
Znuny Version: OTRS 4.0
Real Name: Vishesh
Company: Linuxmantra

Re: Hierarchical Dynamic Feild

Post by vishutux »

Thanks a lot for your response.

I am using ACL and able to limit Subcategory values based on Category, and Subcategory2 value based on Subcategory. The problem with ACL is that,
if I select something in Category , Subcategory2 gets populated, but if anyone directly click on Subcategory2 by bypassing selection of any value from Subcategory then all values of Subcategory2 appears , which is wrong.

Now I have two option, either hiding Dynamic field by default and showing with conditions, or anyway restrict user from selecting Subcategory2 value without selecting any value from Subcategory.

Thanks
Vishesh
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Hierarchical Dynamic Feild

Post by RStraub »

To hide or show fields, you'd need javascript in the template file.

You could also use an ACL which restricts all values of fields2, if nothing is selected in field1.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
vishutux
Znuny newbie
Posts: 8
Joined: 09 Jun 2015, 06:42
Znuny Version: OTRS 4.0
Real Name: Vishesh
Company: Linuxmantra

Re: Hierarchical Dynamic Feild

Post by vishutux »

Thanks for your response.

I am not good in Java Script. With ACL, I am unable to match or set black value. I am putting "" to match blank value, but that is not working.

Thanks
Vishesh
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Hierarchical Dynamic Feild

Post by RStraub »

Create an ACL (which is alphabetical sorted before the others) and forbid all values without matching field1. You might want to filter the action (e.g. AgentTicketPhone/Email) to not forbid it in FreeFields or other actions.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
vishutux
Znuny newbie
Posts: 8
Joined: 09 Jun 2015, 06:42
Znuny Version: OTRS 4.0
Real Name: Vishesh
Company: Linuxmantra

Re: Hierarchical Dynamic Feild

Post by vishutux »

Thanks all,

I managed this using JavaScript.

Thanks
Vishesh
wheelshot
Znuny expert
Posts: 188
Joined: 15 Dec 2014, 20:49
Znuny Version: 4.0.24
Location: QC, Canada

Re: Hierarchical Dynamic Feild

Post by wheelshot »

Care to share your solution with the community please? Thanks :)
Locked