- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2016 05:45 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2016 04:11 PM
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>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2016 06:26 AM
Check if the below thread helps.
UI Macro button onclick not working
If not could you please paste your ui macro.. Screenshots?
Thanks
Akhil
Hit Like/Helpful/Correct, if applicable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2016 08:16 AM
In that thread the fix was to add a div after jelly, and end it before ending jelly tags;
e.g.
<?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>
<button onClick="return myFunc();"> Edit </button>
<script>
function myFunc(){
window.location="/incident.do";
}
</script>
</div>
</j:jelly>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2016 09:55 AM
Also they have used onClick not onclick event ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2016 08:59 AM
<?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 toggle(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="toggle(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>