

function tickBox(tickBoxValue) {

  // this code is responsible for the tick boxes in the form 
  let boxes = document.querySelectorAll(tickBoxValue);
  boxes.forEach(b => b.addEventListener("change", tick));
  function tick(e) {
    let state = e.target.checked; // save state of changed checkbox
    boxes.forEach(b => b.checked = false); // clear all checkboxes
    e.target.checked = state; // restore state of changed checkbox
  }

}


// select Language
tickBox("#lang");

// select sex
tickBox("#sex");

// select present Marital Status
tickBox("#mStatus");

// Will accompany you to Canada?
tickBox("#accompanySpouse");

// Will accompany you to Canada?
tickBox("#accompanyPartner");

// Will accompany you to Canada?
tickBox("#accompanyChildren");

// Been treated for any serious physical
tickBox("#beenTreated");

// Committed, been arrested or charged
tickBox("#commitedBeen");

// Been refused admission to,
tickBox("#beenRefused");

//  Applied for any Canadian Immigration visas
tickBox("#appliedFor");

//    Been refused a visa to 
tickBox("#beenRefusedAVisa");


//  In periods of either peace or war 
tickBox("#inPeriods");

//  During the past five years
tickBox("#duringThe");


