The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Access UI elements value in client script

anand98900
Kilo Contributor

Hi

I am trying to create UI page and access values of UI element in Client script.

Ex -   I had created UI page   as

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

  <g:ui_form>

            <g:ui_reference query="QUERY:active=true" name="user_id" id="user_id" table="sys_user" />

  </g:ui_form>

</j:jelly>

and I tried to access the value of ui_refernce element in client script by

          var id = g_form.getValue('user_id');

but in client script, i am unable to access the value of UI elements.

Can anyone please help me.

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Anand,



g_form is not available in UI Pages. You will have to use DOM manipulation (either document.getElementById() or gel() calls). This is the only place in ServiceNow where DOM access is approved in client scripts.



http://wiki.servicenow.com/index.php?title=UI_Pages


View solution in original post

1 REPLY 1

Chuck Tomasi
Tera Patron

Hi Anand,



g_form is not available in UI Pages. You will have to use DOM manipulation (either document.getElementById() or gel() calls). This is the only place in ServiceNow where DOM access is approved in client scripts.



http://wiki.servicenow.com/index.php?title=UI_Pages