HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web archive/conferencesearch (old) (to delete)/bookdev/custom.js
// (SS,18/5/15) custom script to enable/disable input controls depending on selection

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}

function enable_package(pk_24hr, pk_day) {
  // (SS,21/4/15) if 24 hour then clear the day package combo, if day then clear the 24 hr
  if (pk_24hr) {
    $("select[name='DAY PACKAGE']").prop('selectedIndex', -1)
  }
  else if (pk_day) {
    $("select[name='24 HOUR PACKAGE']").prop('selectedIndex', -1)
    $("select[name='Bedroom type']").prop('selectedIndex', -1)
  }
  
  // disable appropriate combos
  $("select[name='24 HOUR PACKAGE']").prop('disabled', !pk_24hr);
  $("select[name='Bedroom type']").prop('disabled', !pk_24hr);
  $("select[name='DAY PACKAGE']").prop('disabled', !pk_day);  
}

// (SS,21/5/15) added $(function()..) so that this code is called when page fully loaded
$(function() {

  // (SS,18/5/15) for "ambit", disable combos 24 HOUR PACKAGE, DAY PACKAGE, Bedroom Type
  // if "24 hour residential delegate" selected in Attendance radio then 24 HOUR PACKAGE and Bedroom Type combos will be enabled
  // if "Day only delegate" selected in Attendance radio then only DAY PACKAGE combo will be enabled
  if (getParameterByName("id") == "ambit") {
    // (SS,21/5/15) do only if attendance radio button exists
    if ($('input[type=radio][name=Attendance]').length > 0) { 
      // (SS,21/5/15) modified to allow for user going back to make a change
      var l_attendance = $('input[name=Attendance]:checked').val();  
      enable_package(l_attendance == '24 hour residential delegate', l_attendance == 'Day only delegate');
      
      // removed below, changed for all events
      // $(".container span:contains('e.g. access/health/comms')").html('e.g. access'); // replace "e.g. access/health/comms" with "e.g. access"

      $("input[name='Attendance']").click(function () {
        var day_only_delegate = ($(this).val().toLowerCase() == 'day only delegate');
        enable_package(!day_only_delegate, day_only_delegate) 
      });
    }
  }

});