How to change the label name in ui page?

Keang
Tera Contributor

Hello,

We have a UI page featuring Cancel and OK buttons. Could someone please assist in updating the OK button label to 'Yes' and the Cancel button label to 'No' to ensure clarity for our users?  Thank you

 

Keang_0-1719379782396.png

 

 

 

<g:ui_form onsubmit="return invokePromptCallBack('ok');">
    <table width="100%">
        <tr>
            <g:evaluate>
                var title = "${RP.getWindowProperties().get('title')}";
                title = gs.getMessage(title);
            </g:evaluate>
            <!--<td nowrap="true"><label for="glide_prompt_answer">${title}</label></td>-->
            <td nowrap="true">
                <!--<input id="glide_prompt_answer" name="glide_prompt_answer" value="${RP.getWindowProperties().get('text')}"/>-->
              <g:ui_reference name="approvers" table="sys_user" query="active=true" field="name" preview_icon="false"/> 
            </td>
        </tr>
        <tr>
            <td colspan="3" align="right">
                <br/>
                <g:dialog_buttons_ok_cancel 
                   ok="invokePromptCallBack('ok');" 
                   ok_type="button" 
                   cancel="invokePromptCallBack('cancel')" 
                   cancel_type="button" />
            </td>
        </tr>
    </table>
</g:ui_form>

 

1 ACCEPTED SOLUTION

SN_Learn
Kilo Patron
Kilo Patron

Hi @Keang ,

 

You can try below:

 

<g:ui_form onsubmit="return invokePromptCallBack('ok');">
    <table width="100%">
        <tr>
            <g:evaluate>
                var title = "${RP.getWindowProperties().get('title')}";
                title = gs.getMessage(title);
            </g:evaluate>
            <!--<td nowrap="true"><label for="glide_prompt_answer">${title}</label></td>-->
            <td nowrap="true">
                <!--<input id="glide_prompt_answer" name="glide_prompt_answer" value="${RP.getWindowProperties().get('text')}"/>-->
              <g:ui_reference name="approvers" table="sys_user" query="active=true" field="name" preview_icon="false"/> 
            </td>
        </tr>
        <tr>
            <td colspan="3" align="right">
                <br/>
                <g:dialog_buttons_ok_cancel ok_text="${gs.getMessage('Yes')}" ok="return actionOK()" ok_type="button" cancel_text="${gs.getMessage('No')}" cancel_type="button" cancel="cancel()"/>
            </td>
        </tr>
    </table>
</g:ui_form>

 

Output:

 

SN_Learn_0-1719381100881.png

 

Mark this as Helpful / Accept the Solution if this helps

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

View solution in original post

6 REPLIES 6

Community Alums
Not applicable

Hi @Keang ,

You have the solution here : Changing button names in GlideModal UI Page 

 

 

Yashsvi
Kilo Sage

Hi @Keang,

please check below link:

https://www.servicenow.com/community/developer-forum/changing-button-names-in-glidemodal-ui-page/m-p...

Thank you, please make helpful if you accept the solution. 

SN_Learn
Kilo Patron
Kilo Patron

Hi @Keang ,

 

You can try below:

 

<g:ui_form onsubmit="return invokePromptCallBack('ok');">
    <table width="100%">
        <tr>
            <g:evaluate>
                var title = "${RP.getWindowProperties().get('title')}";
                title = gs.getMessage(title);
            </g:evaluate>
            <!--<td nowrap="true"><label for="glide_prompt_answer">${title}</label></td>-->
            <td nowrap="true">
                <!--<input id="glide_prompt_answer" name="glide_prompt_answer" value="${RP.getWindowProperties().get('text')}"/>-->
              <g:ui_reference name="approvers" table="sys_user" query="active=true" field="name" preview_icon="false"/> 
            </td>
        </tr>
        <tr>
            <td colspan="3" align="right">
                <br/>
                <g:dialog_buttons_ok_cancel ok_text="${gs.getMessage('Yes')}" ok="return actionOK()" ok_type="button" cancel_text="${gs.getMessage('No')}" cancel_type="button" cancel="cancel()"/>
            </td>
        </tr>
    </table>
</g:ui_form>

 

Output:

 

SN_Learn_0-1719381100881.png

 

Mark this as Helpful / Accept the Solution if this helps

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Keang
Tera Contributor

Hi @SN_Learn 

Thank you so much for helping with changing the button labels.  However, the buttons are no longer functioning as expected and are not triggering the client script function invokePromptCallBack(type).  Could you please assist with this?

Keang_0-1719416726596.png