Unable to fetch HTML variable value using gel function in UI page client script ?

Virendra K
Kilo Sage

Hi All,

 

I am passing a parameter from UI action to UI page. 

I am able to get the parameter value in HTML page which I am assigning to "jvar_userId" variable in HTML.

I want to access "jvar_userId" variable in client script of UI Page using "gel" function but I can see its not getting fetch. Also UI Page is not getting closed after clicking on "Submit" button. (refer snap)

What may be the reason ? is there any other way to implement this ? please help me.

VirendraKharka_0-1719755719782.png

 

 

Regards,

Virendra

1 ACCEPTED SOLUTION

-O-
Kilo Patron
Kilo Patron

There is no "client side" of UI Page.

UI Pages are HTML (and client script) generators.

They generate HTML server side, which is than transported to client side.

That means that absolutely no UI Page/run-time variable is accessible in the page displayed client side.

 

The Client script, like the HTML is also "generated", so you could write something like

var appId = gel('${ jvar_userId }');

but after generating the final script and when running in the browser that will actually become something like:

var appId = gel('27084be69707c210a3d3ff0de053aff1');

which raises the question which element would have that id, cause your HTML "generator" contains nothing that would end up in an element with that id.

 

In other words a UI Page is like a php source file: it is interpreted and the result is transported to the browser and the same way as you don't have access to php run-time variable in the browser, the same way you don't have access to Jelly/UI Page run-time variables in the browser.

 

View solution in original post

3 REPLIES 3

-O-
Kilo Patron
Kilo Patron

There is no "client side" of UI Page.

UI Pages are HTML (and client script) generators.

They generate HTML server side, which is than transported to client side.

That means that absolutely no UI Page/run-time variable is accessible in the page displayed client side.

 

The Client script, like the HTML is also "generated", so you could write something like

var appId = gel('${ jvar_userId }');

but after generating the final script and when running in the browser that will actually become something like:

var appId = gel('27084be69707c210a3d3ff0de053aff1');

which raises the question which element would have that id, cause your HTML "generator" contains nothing that would end up in an element with that id.

 

In other words a UI Page is like a php source file: it is interpreted and the result is transported to the browser and the same way as you don't have access to php run-time variable in the browser, the same way you don't have access to Jelly/UI Page run-time variables in the browser.

 

Thank you @-O- 

You're most welcome, hope it helped 🙂