UI Macro button onclick not working

surya123
Mega Guru

Hi ,

I want to add a button using UI Macro to the header and on click of the button it should redirect to the incident page.

I tried by creating a UI Macro and invoking it in UI Page. Please let me know what i am missing or an approach with which I can achieve the desired output.

1> created a UI Macro   as

<?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 style='width:100%; font-size: 2em; color: black; text-align: left; background-color: orange;'>

  <button type="button" onclick="return TestFunc();">Add Job</button>

  <script>

  funcion TestFunc()

  {

  window.location= '/incident.do;

  }

  </script>

  </div>

</j:jelly>

2> Created a UI page

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

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

<g:macro_invoke macro="TestHeader" />

<table>

  <tr>

      <td style='width: 100px;'>Menu<br/>Option 1<br/>Option 2</td>

      <td>Do this

.</td>

  </tr>

</table>

</j:jelly>

1 ACCEPTED SOLUTION

zica
Giga Guru

it is working on my instance,


here is the new screenshot :


Screen Shot 2016-01-20 at 13.59.55.png


Have you got the same ?



Kind regards,


View solution in original post

18 REPLIES 18

zica
Giga Guru

Hi Surya,



Please replace your function by this following function :



funcion TestFunc()


  {


  window.location= '/incident.do;


return false;



  }


  </script>



(I added a return statement)


Give a try and let me know if this works or not,



Kind regards,


ZA



Dont feel shy to mark correct or helpful answer if it is correct or helps


Hi Akb


I tried placing return false within the function but still not working.


Should I be creating anything else apart from Ui Page and Ui Macro??


If you can help me with process to achieve this.




Thanks in advance


surya


zica
Giga Guru

I made a typo sorry,



try again this please :



<script>
function TestFunc()
{
window.location = '/incident.do';
return false;


}
</script>




Kind regards,


ZA



Dont feel shy to mark correct or helpful answer if it is correct or helps



Hi Akb


Still the same issue. Button isnt responding to click at all