How to set field focus on catalog item through UI Policy script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2018 01:32 PM
Hi all
I am trying to set field focus on a catalog item I am creating for the Service Catalog. I have a UI Policy script that runs when FIELD1 = YES, and I want the cursor to be placed in FIELD2. The script runs & works when I use the "TRYIT" button... but gives various messages when I run it from Internet Explorer or CHROME.
- when I use the field name from the catalog item in the UI Policy script...
var tmp1 = g_form.getControl('client_new_name');
tmp1.focus();
- I get IE msg: TypeError: Unable to get property 'focus' of undefined or null reference
- I get Chrome msg: TypeError: Cannot read property 'focus' of null
- when I use the SYSID in my script
var tmp1 = g_form.getControl("IO:8407782cdb234340b2acdd0b5e961913");
tmp1.focus();
- I get IE msg... focus not implemented for IO:8407782cdb234340b2acdd0b5e961913
- nothing pops up on CHROME
What do these error mean. I searched hi & low in the communities but nothing works on either IE or CHROME browser. Please help me
thanks... dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2018 01:44 PM
Hey David,
Please Refer below Threads might be helpful to you:
How to set focus on mandatory fields if they are not filled?
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2018 12:37 PM
Hi Rajesh
I reviewed and tried a couple of the scripts that were documented in the 2 Community posts.
When I made & saved the different "focus" script changes in the UI Policy… every combination of "focus" script I tried and tested with the "TRY IT" button…. The field focus worked.
When I tried from the Internet Explorer and Chrome browser, none of the field focus script work on IE & Chrome. This error message pops up on both browsers… There is a JavaScript error in your browser console. When I went to the DEV TOOL of each browser, both showed different messages
I don't understand why the "TRY IT" button works, but errors out when I test the catalog item from the Service Catalog home page. It is 2 lines of code… to place the cursor to another field.
Do you have any other ideas.
Regards
David Chan
Office (416) 502-7122