Hide Options from Select field for Portal

  • 17 February 2019
  • 4 replies
  • 406 views

Hello, 


as we have two portals, I would like to have different forms in each portal. With having only two dependent ticket fields. I would like to use one for both portals, and hide the options which are not relevant for portal A for example. 


I tried different Javascript codes, but they dont work. 


Can anyone help? 



This topic has been closed for comments

4 replies

Userlevel 4
Badge +12

Hello Anastasia,


Navigate to the specific product portal and replace the IDs. You can obtain the ID for fields from the “Elements” tab in the console. 

Please use the following code to hide the field from one of the portals.


<script type="text/javascript">

jQuery(document).ready(function(){

jQuery('#helpdesk_ticket_custom_field_checkbox1_777701,#helpdesk_ticket_custom_field_text_777701,#helpdesk_ticket_custom_field_date1_777701').parent().parent().remove();



});

</script>



Cheers!

Hi Aravind,


I already know how to hide the entire ticket field from one portal, but I need to hide just "option1" from the dropdownmenu for example. 
Your code refers to 'date1' of a field. How/where can I find this specific field ID? 


Thank you in advance!


Userlevel 4
Badge +12

Hi,


Here's a sample code that will help you to remove one of the dropdown options from a field.


jQuery('#helpdesk_ticket_custom_field_cf_groups_797184 option[value="Second Choice"]').remove();


Cheers!

Thanks! Worked!