I have designed a ui page and used onclick() function call in it.It is working fine in ui page .i have tried the same code using ui macro,but onclick function is not getting executed.What may be the possible reasons for this scenario?

khusboo1
Kilo Expert

Hi friends,Please help me in this

1 ACCEPTED SOLUTION

Change the function name from toggle to something else. Looks like this function name has something to do with the behavior of the code. It is giving me errors on the console. Change it to toggleCustom() and you are good to go. Your modified code



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


  <div>


<html><head></head>


<script>



function toggleCustom(button) {


  if (button.value == "Active") {


      button.value = "Last 6 months";


  document.getElementById("active_incidents").style.display="block";


  document.getElementById("last_six_months").style.display="none";





  } else {



      button.value = "Active";


  document.getElementById("active_incidents").style.display="none";


  document.getElementById("last_six_months").style.display="block";



  }


}



  </script>


<body>


<form action="">


<input type="button" id="1" value="Active" style="color:blue"


      onclick="toggleCustom(this);">


  </input>


  <div id="active_incidents" style="display:block">


  <iframe src="incident_list.do?sysparm_query=active=true" width="800" height="800">


  <p>Your browser does not support iframes.</p>


</iframe>


  </div>


  <div id="last_six_months" style="display:none">



  <iframe src="incident_list.do?sysparm_query=active=true^assignment_group=31a476a34f1022009cd07e918110c70e^opened_by=javascript:gs.getUserID()" width="600" height="800">


  </iframe>


  </div>


</form></body></html>


  </div>


</j:jelly>


View solution in original post

6 REPLIES 6

Change the function name from toggle to something else. Looks like this function name has something to do with the behavior of the code. It is giving me errors on the console. Change it to toggleCustom() and you are good to go. Your modified code



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


  <div>


<html><head></head>


<script>



function toggleCustom(button) {


  if (button.value == "Active") {


      button.value = "Last 6 months";


  document.getElementById("active_incidents").style.display="block";


  document.getElementById("last_six_months").style.display="none";





  } else {



      button.value = "Active";


  document.getElementById("active_incidents").style.display="none";


  document.getElementById("last_six_months").style.display="block";



  }


}



  </script>


<body>


<form action="">


<input type="button" id="1" value="Active" style="color:blue"


      onclick="toggleCustom(this);">


  </input>


  <div id="active_incidents" style="display:block">


  <iframe src="incident_list.do?sysparm_query=active=true" width="800" height="800">


  <p>Your browser does not support iframes.</p>


</iframe>


  </div>


  <div id="last_six_months" style="display:none">



  <iframe src="incident_list.do?sysparm_query=active=true^assignment_group=31a476a34f1022009cd07e918110c70e^opened_by=javascript:gs.getUserID()" width="600" height="800">


  </iframe>


  </div>


</form></body></html>


  </div>


</j:jelly>


Abhinay Erra
Giga Sage

Share the code of the UI macro here