The CreatorCon Call for Content is officially open! Get started here.

how get the values of hidden fields in client script?

revathy
Kilo Expert

Hi all,

I have a client script where i need to get the value of a hidden field in a form is it possible?

script:

-------

var a = g_form.getValue('task_number');

alert(a);

I am not getting any value when i give alert.

Thanks.

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Bring the field on the form display and hide it using g_form.setDisplay


Then you will be able to read it as its present on the form. if its not in the layout itself then you will have to read it from server side and will have to make an ajax call for it, long way.


-Anurag

View solution in original post

6 REPLIES 6

Kalaiarasan Pus
Giga Sage

The field name should be number instead?



var a = g_form.getValue('number');


Wow i didnt even notice that


-Anurag

Hi Anurag Tripathi,



Thanks.



The field name is 'task_number' only. i am sure about it.


g_form can fetch the values of the field only if they exist on the form layout.


So if the fields don't exist on the form layout, then display rule part suggested by Harsh is the way to go.