CA Service Management

  • 1.  Adding conditional checkboxes in htmpl pages

    Posted Aug 27, 2015 04:24 AM

    Hi All,

    we are trying to add some new defined fields in change and incident related htmpl pages (ie. detail_chg.htmpl and detail_in.htmpl) in service desk r12.7.
    For example,
    1.  We have added one check box (named temporary change) and two date fields (named "To Date" & "From Date") and we want to display these fields in such a way that when user checks the check box then only the date fields should appear ( i.e conditional check box concept) as mandetory fields.
    2.  We have added a checkbox (names "SLA brached?") and a dropdown which has the penalty clauses if the user checks the checkbox then only drop down should be appeared (as mandetory)

    Is it possible to achieve?
    Has anyone done this before? If yes, please guide us.

    Sailee Dale
    Service Desk Team
    Data Center
    Bank of Maharashtra, Pune

  • 2.  Re: Adding conditional checkboxes in htmpl pages

    Posted Aug 27, 2015 04:43 AM


    you can achieve this by javascript,

    example could be found in detail category form (detail_isscat, pcat, chgcat),

    where when you click Include SS, ss_sym attribute displays.


    But this will not work with complex headers like calendar inputs or lookups so you need to make your own function.

    Algorithm will look like:

    I.1. get input element;

    I.2. get input elements parent (td element);

    I.3. hide it/show it;


    II.1. get label for input element;

    II.2. get labels parent (td or th element);

    II.3. hide it/show it;


    III.1. mark/unmark field as required.




  • 3.  Re: Adding conditional checkboxes in htmpl pages

    Posted Aug 27, 2015 04:53 AM

    here is some of my code, hope this helps:

    // ADD THIS AFTER YOUR dtlCheckbox
    function switchRealDate(value) {
     // console.log('Value : ' + value);
     if (value == 1) {
      getParentAsTable(main_form.elements["SET.z_real_date_fake"]).style.display = "";
      getParentAsTable(findLableForControl(main_form.elements["SET.z_real_date_fake"])).style.display = "";
      getParentAsTable(main_form.elements["SET.z_real_date"]).style.display = "none";
      getParentAsTable(findLableForControl(main_form.elements["SET.z_real_date"])).style.display = "none";
      detailMakeReq("z_real_date_fake", false);
      detailMakeReq("z_real_date", true);
     } else {
      getParentAsTable(main_form.elements["SET.z_real_date"]).style.display = "";
      getParentAsTable(findLableForControl(main_form.elements["SET.z_real_date"])).style.display = "";
      getParentAsTable(main_form.elements["SET.z_real_date_fake"]).style.display = "none";
      getParentAsTable(findLableForControl(main_form.elements["SET.z_real_date_fake"])).style.display = "none";
      detailMakeReq("z_real_date_fake", true);
      detailMakeReq("z_real_date", false);
    function getParentAsTable(obj) {
      var parent;
      var pcount = 0;
      parent = obj.parentElement;
      // console.log(parent.tagName);
      while ( (parent.tagName != 'TD')&&(parent.tagName != 'TH')&&(pcount<4) ) {
       parent = parent.parentElement;
      if ((parent.tagName == 'TD')||(parent.tagName == 'TH')) {
       return parent;
      } else {
       return obj.parentElement;
    function findLableForControl(el) {
      var res_str = "not_found";
      if (typeof (el) != "undefined") {
       var idVal =;
       labels = ahdframe.document.getElementsByTagName('label');
       for (var i = 0;i < labels.length;i++) {
        if (labels[i].htmlFor == idVal)
        return labels[i];
      } else return res_str;

  • 4.  Re: Adding conditional checkboxes in htmpl pages

    Posted Aug 27, 2015 05:02 AM

  • 5.  Re: Adding conditional checkboxes in htmpl pages

    Posted Sep 01, 2015 06:38 PM

    Hi Sailee - Did the responses provided help answer your question? If so please mark the appropriate as Correct Answer. Thanks! Chris

  • 6.  Re: Adding conditional checkboxes in htmpl pages

    Posted Sep 02, 2015 02:36 AM

    Hi Chris,

    We tried conditional checkboxes for displaying the text box. It's working fine.

    But we are yet to try it for displaying dropbox or date fields.



    Sailee Dale