UI Page HTML - field shows REQUIRED when not

kristenankeny
Tera Guru

I'm creating a UI Action that pulls up a dialog window to create an approval task associated with a requested item. The UI page has some scripting issues, but I'm not very familiar with HTML, so I'm not sure what I'm doing wrong.

find_real_file.png

The first issue is that I've got a ton of wasted space to the left of my multiline text field and it's showing "REQUIRED". I don't want to show this, as this field I have set to not mandatory.

The other issue is not enough padding to the right of my fields.

Any help is greatly appreciated. The existing script is below.

HTML:

<?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:ui_form>

<input type="hidden" id="cancel_or_submit" name="cancel_or_submit" value=""/>

<input type="hidden" id="item" name="item" value="${sysparm_id}"/>

<table width="100%">

              <tr>

                  <td><label for="${jvar_app_query}" onclick="" dir="">${gs.getMessage("Approver:")}</label><g:ui_reference name="sys_user" table="sys_user" columns="user_name;name" completer="AJAXTableCompleter"/></td>

              </tr>

  <tr></tr>

  <tr>

            <td>

                <!-- Comments text field (Contains comments from originating record as a default) -->

      <label>${gs.getMessage("Comments:")}</label><g:ui_multiline_input_field name="dial_comments" mandatory="false" />

            </td>

        </tr>

              <tr id="dialogbuttons">

                      <td colspan="2" align="right">

                              <g:dialog_buttons_ok_cancel ok="return actionOK();" cancel="return cancel();"/>

                      </td>

              </tr>

</table>

</g:ui_form>

</j:jelly>

Client script:

function actionOK(){

      var app_id = gel('sys_user').value;

      if (app_id == '') {

              alert(getMessage("Please select an approver"));

              return false;

  }

  var c = gel('cancel_or_submit');

      c.value = "submit";

  return true;

}

function cancel(){

  var c = gel('cancel_or_submit');

      c.value = "cancel";

  return true;

}

Processing script (the comments aren't working yet):

if (cancel_or_submit == "submit") {

      var gr = new GlideRecord('sysapproval_approver');

  gr.initialize();

  gr.approver = request.getParameter('sys_user');

  gr.comments = request.getParameter('dial_comments');

  //gr.source_table = 'sc_req_item';

  //gr.document_id = request.getParameter('item');

  gr.sysapproval = request.getParameter('item');

  gr.state = 'requested';

  gr.insert();

  //reloadWindow(window);

  //action.setRedirectURL(current);

      //response.sendRedirect("dev17435.service-now.com/sysapproval_approver.do?sys_id=" + gr.sys_id);

  var urlOnStack = GlideSession.get().getStack().bottom();

  response.sendRedirect(urlOnStack);

}

else {

      var urlOnStack = GlideSession.get().getStack().bottom();

      response.sendRedirect(urlOnStack);

}

5 REPLIES 5

You'll need g:macro invoke to call it in e.g.

<g:macro_invoke macro="name of custom macro" id="custom" name="custom"/>