Hiding the Priority field in the ticket submission form

You can set, per department, a default priority that will be automatically selected in the Priority field when choosing the department in the ticket submission form (Submit Layout menu item). This means that, if you wish to not allow your users to choose a priority for the tickets they are about to submit, you can do so by hiding the Priority field using a little bit of custom scripting implemented through template overrides.

 
Template overrides

Joomla! offers a very useful feature that will greatly aid you in safely performing source code modifications for extensions' views - template overrides. Basically, you can set up any Joomla! template to load a custom view for any extension's (components or modules) feature, without having to alter the original files. In doing so, you will keep your modifications safe, should any future updates be performed for that component.

How it's done

Although the entire process of creating template overrides is explained in the article linked above, we will also be providing some explanations on how this is done in general, and then we'll provide the implementation for our own scenario:

Each Joomla! template contains a folder called html. Its purpose is specific for template overrides, all of the modified extension views need to be stored here. However, copying the modified views in this folder is not sufficient, a part of the folder structure from where they originate needs to be recreated here, so that the template "knows" which views it should load the files for. So, if the original view is stored in:

/components/com_component/views/your_view/

the modified view should be stored in:

/templates/template_name/html/com_component/your_view

 
Hiding RSTickets!Pro's Priority field

Now, let's get back to our implementation:

The template override
  • Head to /components/com_rsticketspro/views/submit/tmpl
  • Here, you will find the default.php file. This file controls the Submit Layout menu item's view, copy it
  • Let's assume that you are using Joomla!'s default Beez_20 template. Head to /templates/beez_20/html/ and create the following folder structure:

    com_rsticketspro/submit

  • Paste the default.php file in the submit folder.
 
The code

Edit the copied file and, at its very end, add the following code:

 
    document.getElementById('jform_priority_id').style.display="none";
    document.getElementById('jform_priority_id-lbl').style.display="none";
 

...right before the ending </script> tag.

That code will look for the page's elements by their id's (jform_priority_id and jform_priority_id-lbl) and will alter their style attribute by setting the display property to none. This way, the Priority field's label and select group will not be removed from the page, but only hidden from the user's view.


4 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that

You Should Also Read

Knowledgebase template overwrite

Extract some database values inside a custom field