g_form not working in UI Pages
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2016 11:25 PM
Html 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:ui_form>
<p>Login Form</p>
Username : <input type="text" name="username" size="50"/>
Password : <input type="password" name="pwd" /><br/>
<g:dialog_button
id="ok_button"
title="Login"
type="button"
onclick="actionOK"
style_class="btn btn-primary"
style="min-width: 5em;">Login</g:dialog_button>
</g:ui_form>
</j:jelly>
Client Script :
function actionOK()
{
//var username = gel('username').value;
//var pwd = gel('pwd').value;
var a = g_form.getValue('username');
var b = g_form.getValue('password');
alert("Username = "+a+" Password = "+b);
}
gel() function is working but g_form is not working.
Plzz anyone can fix this problem
(Version : Helsinki)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2016 01:04 AM
Hi Ashish,
If you are building a standalone UI page which is not used as a pop up on a table form, you cannot use this.
g_form is only available when a table or a catalog form loads on the browser. Once the table or catalog form loads, you can use g_form in the UI page which is used as a pop on top of the form. It can be GlideDialogWindow.
Ref:Re: Can we use g_form,g_user in Client script of UI page???
You may find below link helpful too..
Re: g_form not initialized on a custom CMS page
Re: UI Page onChange get reference value
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
Thanks,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2016 01:08 AM
HI,
var username = gel('username').value;
var pwd = gel('pwd').value;
As per my knowledge .value only works because it is jelly g_form works only servicenow forms. GlideForm.js is the Javascript class used to customize forms.
Jelly tags are just for general reference. They are divided into Jelly tags that come with Jelly, and Glide tags, which are tags that we created during our implementation.