g_form.getControl() not working in Service Portal in Catalog Client Script

gaurip
Mega Expert

Hi all,

I'm working on Helsinki Service Portal.

'resolving_change' is my checkbox field. Using g_form.getControl('resolving_change') to check if resolving_change field is visible on the form. But its not working.

Does anyone know a fix for this or an alternative I can use for g_form.getControl() in Service Portal?

-Gauri

1 ACCEPTED SOLUTION

Found a work around. I changed my logic to check the checkbox field is checked depending upon the value selected from some specific field. (To give you a bit of a background, scenario here is that - my checkbox field depends on the value selected from some other field).



In this particular case, it was not appropriate to use g_form.getControl().



As per Samiul's suggestion, for those who need to use g_form.getControl(), use g_form.hasField() instead. Works better in Service Portal.



-Gauri


View solution in original post

7 REPLIES 7

samiul1
Tera Expert

Instead of g_form.getControl(), use g_form.hasField() to determine if a field is present


Hi Samiul,



This checkbox field won't be visible always as it depends on some other field selection.



Problem with g_form.hasField() is - it'll always return true even if the checkbox field is hidden.



My requirement is to check if that checkbox is selected ONLY WHEN IT IS VISIBLE.



-Gauri


Found a work around. I changed my logic to check the checkbox field is checked depending upon the value selected from some specific field. (To give you a bit of a background, scenario here is that - my checkbox field depends on the value selected from some other field).



In this particular case, it was not appropriate to use g_form.getControl().



As per Samiul's suggestion, for those who need to use g_form.getControl(), use g_form.hasField() instead. Works better in Service Portal.



-Gauri


Hi Samiul,



Not saying what you posted is different or incorrect. For the people who will read the post later, for them I thought I should give my comments/tips and what my experience was.



-Gauri