Hide DynamicField when Empty

Moderator: crythias

Post Reply
vincent13
Znuny newbie
Posts: 43
Joined: 28 May 2013, 12:38
Znuny Version: 3.2000
Company: cpr sncf

Hide DynamicField when Empty

Post by vincent13 »

Hello All,

Like the Howto here : viewtopic.php?f=60&t=24116

My need is to hide all the DynamicField when the content is empty. (because of ACL do not manage visibility in 3.3.9)
So I will manage not to give content for DynamicField using ACL and then do not show automaticly them if not needed to use.

But :
- is there any documentation on all the javascript object /method anywhere so that I understand how to manipulate all this objects
because I suppose the content of a date or dropdown or textarea is not the same to manipule.

- or directly give me the method to get the content for text, textarea, checkbox , dropdown multiselect,date;datetime ? ;)

- is there a possibility to get in the DTL in javascript the list of all the dynamicField existing in the page ?
lab : otrs 5rc1 test : otrs 3.3.15 prod : cluster 3.3.15
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Hide DynamicField when Empty

Post by reneeb »

viewtopic.php?f=60&t=8032&start=50#p82769

jquery is used for the JavaScript stuff. So you can see jquery.com for a reference of methods...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Hide DynamicField when Empty

Post by crythias »

vincent13 wrote:My need is to hide all the DynamicField when the content is empty.
In a form, the content is generally empty, which is why it's asking to fill in content. On a page like TicketZoom, a field and its data will not show if it does not have content.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
vincent13
Znuny newbie
Posts: 43
Joined: 28 May 2013, 12:38
Znuny Version: 3.2000
Company: cpr sncf

Re: Hide DynamicField when Empty

Post by vincent13 »

it depend on the situation ..

not true for example for drop down, multiselect ...

or if you set a default value ...
Last edited by vincent13 on 06 Nov 2014, 20:31, edited 1 time in total.
lab : otrs 5rc1 test : otrs 3.3.15 prod : cluster 3.3.15
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Hide DynamicField when Empty

Post by crythias »

I don't understand the request. It doesn't make sense to hide a field in a form because there's no data in the field. That's what a form is for. To fill the fields. If you don't want that field, don't provide that field at all.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
vincent13
Znuny newbie
Posts: 43
Joined: 28 May 2013, 12:38
Znuny Version: 3.2000
Company: cpr sncf

Re: Hide DynamicField when Empty

Post by vincent13 »

Read carefully my first post ;)

I want to be able to show or not, depending on ACL criteria, dynamicField.

As otrs is not able to do that , I'am trying to use the Howto visible topics to hide all my DynamicField if their data are drop by ACL criteria...

simple
lab : otrs 5rc1 test : otrs 3.3.15 prod : cluster 3.3.15
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Hide DynamicField when Empty

Post by crythias »

I would never have guessed you wanted to do that, no matter how many times I would have read your post. And, no.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Hide DynamicField when Empty

Post by jojo »

There is a feture add on: https://www.otrs.com/feature-add-on/otrs-ticket-forms/ this includes HideShowDynamic Fields via ACL. But you have to be service customer of OTRS Grouo to get it
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
vincent13
Znuny newbie
Posts: 43
Joined: 28 May 2013, 12:38
Znuny Version: 3.2000
Company: cpr sncf

Re: Hide DynamicField when Empty

Post by vincent13 »

thanks jojo ,I know that xxx provide addon but it is not free.

my dynamicField is a dropbox

set an acl match properties any -> not possible Ticket DynamicField no values
set an acl match properties Ticket Service "toto" -> possible Ticket Dynamicfield all values

here is my code for :

if ( document.getElementById('DynamicField_Application').length > 0 ) {
$('#DynamicField_Application').parent().removeClass( 'Hidden' );
$('#DynamicField_Application').parent().addClass( 'Mandatory' );
$('#LabelDynamicField_Application').parent().removeClass( 'Hidden' );
$('#LabelDynamicField_Application').parent().addClass( 'Mandatory' );
} else {
$('#LabelDynamicField_Application').parent().addClass( 'Hidden' );
$('#LabelDynamicField_Application').parent().removeClass( 'Mandatory' );
$('#DynamicField_Application').parent().addClass( 'Hidden' );
$('#DynamicField_Application').parent().removeClass( 'Mandatory' );

....

<script type="text/javascript">//<![CDATA[
$('#ServiceID').bind('change', function (Event) {
Core.AJAX.FormUpdate($('#NewCustomerTicket'), 'AJAXUpdate', 'ServiceID', ['TypeID', 'Dest', 'PriorityID', 'SLAID', $Data{"DynamicFieldNamesStrg"}]);
nonetext();
});
//]]></script>


But there is not garanty the nonetext() function is run after the dynamicfield data update so sometimes it is ok, sometimes not ...


is there any way to run nonetext function only after a dynamicfield as been updated ?

or even better addclass or remove class on the server side during the ajax call
lab : otrs 5rc1 test : otrs 3.3.15 prod : cluster 3.3.15
jojo
Znuny guru
Posts: 15019
Joined: 26 Jan 2007, 14:50
Znuny Version: Git Master
Contact:

Re: Hide DynamicField when Empty

Post by jojo »

well why should everything be free? OTRS is open Source not Freeware
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
Post Reply