Modifying out of the box button UI in Jelly

nmartinez
Kilo Contributor

I am creating a custom UI page in Jelly; I am using the out of the box [dialog_buttons_ok_cancel] UI macro on the page. I'm also using the [dialog_button_ok] macro as baseline to create a new macro to perform an additional function. The problem is that my new custom UI Macro button doesn't even display on the page.

I could use the [dialog_button_ok] macro itself; however the display value for the button is "OK". I can't modify this UI because it has other out-of-the-box UI buttons that depend on it. Below is the code for my custom UI Macro button; it's almost identical other then changing the display value of the button, and changing the variable names.

(Custom 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">
<g:macro
new_emp_action="actionOK()"
new_emp_id="ok_button"
new_emp_type="submit"
/>
<g:dialog_button
id="${jvar_new_emp_id}"
type="${jvar_new_emp_type}"
onclick="${jvar_new_emp_action}"
style="width: 5em;">${gs.getMessage('Click here if user is not found')}</g:dialog_button>
</j:jelly>


Here is the original button: (Out of the box 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">
<g:macro
ok="actionOK()"
ok_id="ok_button"
ok_type="submit"
/>
<g:dialog_button
id="${jvar_ok_id}"
type="${jvar_ok_type}"
onclick="${jvar_ok}"
style="width: 5em;">${gs.getMessage('OK')}</g:dialog_button>
</j:jelly>


And this is the dependent button that both macros call: (Out of the box code)


<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide">
<g:macro onclick="doNothing()" style="" id="MANDATORY" type="submit" />
<button type="${jvar_type}" id="${jvar_id}" onclick="${jvar_onclick}" title="${jvar_title}" style="${jvar_style}"><g:insert/></button>
</j:jelly>


Last, this is the line I call my custom button from in my UI page:


<td>
<j:if test="${jvar_use_newhire != 'true'}"> <!-- this is so the button only shows when it's a new hire -->
<!-- <input id="create_user" type="button" value="Click here if user is not found" onclick="createUser()"> </input> -->
<g:dialog_button_new_emp new_emp_action="return createUser()" new_emp_id="create_user" new_emp_type="button"/>
</j:if>
</td>


Would anyone be able to point out what I am doing wrong with the code provided?

2 REPLIES 2

JoeLighthall
Giga Contributor

I am having this exact same problem right now.   Is there a solution?


I tried this again and found it only to work when invoking the macro this way...


<g:macro_invoke macro="macro_name" />




and not this way...


<g:macro_name/>




I'm not sure why, perhaps this is a bug? My instance is Berlin so maybe this is fixed later?   Either way it works the long way for me.