- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2020 07:04 AM
Hi All,
Please find the scenario below:
I have a UI page with 4 fields. When the field value for one field (field A) changes, I need to check if other three fields are empty or filled. If the three fields are empty, I need to display a message on the UI page to request the user to fill in other three fields. And also, wipe off the value of field A which the user first entered.
g_form.setValue("fieldA","") in the client script of UI page doesn't work
Please suggest a way to achieve it
Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2020 02:00 AM
so you want to empty your html field. i thought you want to empty normal form field.
you should use below two line instead of g_form.
gel('sys_display.handover_by').value = "";
gel('handover_byLINKreplace').style = 'visibility: hidden; display: none;';
Note: I have tested it on my personal instance.
If my answer helped you , kindly mark it as correct and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2020 04:46 PM
g_form.setValue() does work in UI Pages client script. May be the value you are trying to set is empty/undefined. Can you please put an alert and see if you are getting the value in the source variable?
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2020 11:41 PM
I believe g_form works on a UI Page when it's associated with a GlideDialogWindow and getting/setting values from a table form.
It doesn't work on elements that don't belong to a table in UI Pages.
To get/set values on elements on a UI page that aren't on a table you can use a couple of different options:
- vanilla javascript such as document.getElementById, getElementByClass, querySelector etc.
- system jQuery such as $j('selector')
- gel('selector')
- Prototype using double dollar sign: $$('selector')
Here are some screenshots showing this console logging out the usages:
UI page as a standalone page:
The same UI Page used through GlideModal:
Hopefully this helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2020 12:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2020 01:31 AM
Hi All,
Thank you for your response
Please find the attached code for reference.
I am able to extract the values in the fields by using gel
However, the requirement is, that, if values in three fields are empty, I need to wipe the value in the fourth field (which is a reference field)
I have also tried g_form.setValue('handover_by',"");
But it is not taking off the value.
Please suggest in case if I'm doing anything wrong in the code, or in case if there is any other way of achieving this