Pre-setting dropdown values in Job Requisition Template

Input Form Configuration - Custom Code - Pre setting POST TO field value

This is scripting to be placed in the Custom Code tab in the Input Form Configuration for configurable Job Templates

 

Post To - this code will pre-set the Hirebridge job board value, ie: which Hirebridge boards to send the job to (Intranet Only, Intranet & Career Center, Career Center Only)

 

This particular code will pre-set the job to Career Center only, which is option value 2

 

To make different defaults, use these values

 

0 - Intranet & Career Center

1 - Intranet Only

2 - Career Center Only 

 

Only works when creating new role - This also takes into account an edit, so that we don’t overwrite the previously saved data selection

 

 

Basic Method - this is for templates using the regular dropdown list

 

<script type="text/javascript">

    window.onload = function() {

        // Check if ctl05_joblistid exists first

        var joblistidField = document.getElementById('ctl05_joblistid');

 

        // If ctl05_joblistid does not exist, proceed

        if (!joblistidField) {

            // Get the dropdown by its ID

            var dropdown = document.getElementById('ctl05_intranetjob');

            

            // Check if the dropdown exists

            if (dropdown) {

                // Set the value to '2' (Make sure the value exists in the dropdown)

                dropdown.value = '2';

 

                // Trigger the change event if needed

                var event = new Event('change');

                dropdown.dispatchEvent(event);

            }

        }

    };

</script>

 

Select 2 Method - This is the method to use IF the template contains searchable dropdown lists 

 

Pre-setting POST TO field using Select2 method (select2 is the library used with the searchable dropdowns)

 

<script type="text/javascript">

    $(document).ready(function() {

        // Initialize Select2 for the dropdown

        $('#ctl05_intranetjob').select2();

 

        // Check if ctl05_joblistid exists first

        if ($('#ctl05_joblistid').length <= 1) {

            // If ctl05_joblistid does not exist, set the value to '2'

            $('#ctl05_intranetjob').val('2').trigger('change');

        }

    });

</script>

 

Input Form Configuration - Custom Code - Pre setting any dropdown field

 

This is java scripting to be placed in the Custom Code tab in the Input Form Configuration for configurable Job Templates, and can be used to pre-set any dropdown field to a particular value.

 

  • Only for use with custom templates using Input Form Configuration
  • Only works when creating new role - This also takes into account an edit, so that we don’t overwrite the previously saved data selection

 

How to use - First you will need to determine which field you want to preset. This will require a bit of programming, as you will need to determine the actual field name of the control. To do this, you will need to right mouse click on the dropdown field you are looking for, and then find the control id name. In this example, we are looking to pre set the Category dropdown. After right mouse click, you will notice that the id=”ct105_jobcat”

 

 

Next, you will need to locate the field value for the category you want to pre set. You do this by going to Administration->Dropdown List Manager->Categories and clicking to view the list. Locate the category you want to pre set, and copy the HB Value.

 

When creating the scripting, you will need both the value from the id, in this case $ct105_jobcat, as well as the HB Value for the field you wish to be the default value; for this example, we will use the HB Value of 18, which is the Accounting/Auditing job category.  Copy the scripting below, and paste in the Custom Code section of the Input Form Configuration tab when editing the Job Template. Click Save



 

When adding a new role, the Category will be pre- set to Accounting/Auditing

 

Basic Method - this is for templates using the regular dropdown list

 

<script type="text/javascript">

    window.onload = function() {

        // Check if ctl05_joblistid exists first

        var joblistidField = document.getElementById('ctl05_joblistid');

 

        // If ctl05_joblistid does not exist, proceed

        if (!joblistidField) {

            // Get the dropdown by its ID

            var dropdown = document.getElementById('ctl05_jobcat');

            

            // Check if the dropdown exists

            if (dropdown) {

                // Set the value to '18' (Make sure the value exists in the dropdown)

                dropdown.value = '18';

 

                // Trigger the change event if needed

                var event = new Event('change');

                dropdown.dispatchEvent(event);

            }

        }

    };

</script>

 

Select 2 Method - This is the method to use IF the template contains searchable dropdown lists 

 

Pre-setting POST TO field using Select2 method (select2 is the library used with the searchable dropdowns)

 

<script type="text/javascript">

    $(document).ready(function() {

        // Initialize Select2 for the dropdown

        $('#ctl05_jobcat').select2();

 

        // Check if ctl05_joblistid exists first

        if ($('#ctl05_joblistid').length <= 1) {

            // If ctl05_joblistid does not exist, set the value to '18'

            $('#ctl05_jobcat').val('18').trigger('change');

        }

    });

</script>



Was this article helpful?
0 out of 0 found this helpful