- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2020 06:01 AM
Hi Community,
I want to throw an error for less than 3 characters in a string field but to make the field accept the value and change only the border of the field to green color if it is more than 3.The border-color scenario is throwing an error in compiler level only. I am using the following script :-
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}
if (newValue.length < 4) {
g_form.clearValue('u_username');
g_form.showFieldMsg('u_username','Username must be atleast 3 characters','error');
}
else
g_form.getControl('u_username').style.border-color=#2ecc71; // compiler is throwing error in this case only.
Kindly help me in this scenario.
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2020 06:34 AM
(edited, sorry, had the wrong variable name)
Try this: I usually just set the value for style.
g_form.getControl('u_username').style='border-color: #2ecc71;';
Hope this helps!
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2020 06:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2020 06:33 AM
As you are manipulating the DOM, check if isolate script should be set to false.
Thanks
Sudhanshu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2020 06:34 AM
(edited, sorry, had the wrong variable name)
Try this: I usually just set the value for style.
g_form.getControl('u_username').style='border-color: #2ecc71;';
Hope this helps!
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2020 06:46 AM
Thanks Michael. This worked Perfectly.