- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2019 02:42 AM
hi
I have one form where I have one category drop down field with 3 options:
category: america , asia, london
now based on this category i need to disabled fields
- if i select america only my location field should be changeable (drop down field)
- if i select asia then zone field should be changeable (single line text)
- if i select london then place field field should be changeable (single line text)
and on load of this form i need location,zone, place should only be readable..... how can i achieve this am new to snow so please help me to complete this
thanks in advance!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2019 02:59 AM
Hi,
Use onload client script for setting location, zone & place field to be read-only by below script.
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setReadOnly('location',true);//replace locationwith appropriate dictonary name of field
g_form.setReadOnly('zone',true);//replace zone with appropriate dictonary name of field
g_form.setReadOnly('place',true); //replace place with appropriate dictonary name of field
}
Use onChange client script as below for Category field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var catis=g_form.getValue('category');
if(catis=='America')
{
g_form.setReadOnly('location',false);
}
else if(catis=='Asia')
{
g_form.setReadOnly('zone',false);
}
else if(catis=='London')
{
g_form.setReadOnly('location',false);
}
}
Make sure you replace the dictonary name accordingly as per the names in the instance.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2019 02:59 AM
Hi,
Use onload client script for setting location, zone & place field to be read-only by below script.
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setReadOnly('location',true);//replace locationwith appropriate dictonary name of field
g_form.setReadOnly('zone',true);//replace zone with appropriate dictonary name of field
g_form.setReadOnly('place',true); //replace place with appropriate dictonary name of field
}
Use onChange client script as below for Category field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var catis=g_form.getValue('category');
if(catis=='America')
{
g_form.setReadOnly('location',false);
}
else if(catis=='Asia')
{
g_form.setReadOnly('zone',false);
}
else if(catis=='London')
{
g_form.setReadOnly('location',false);
}
}
Make sure you replace the dictonary name accordingly as per the names in the instance.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2019 03:42 AM
thankyou so much for your time it worked!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2019 03:01 AM
Hi,
The easiest way to do this is to use UI Policy. Also when it comes to making fields visible/hidden, read-only or mandatory it is Best practice to use UI Policy. And if you do not need to hide entire sections in most case this a no-code approach.
For example, make a field visible if category is America:
Result will be this:
This way you can group behaviours based on the conditions. E.g. when a category is America make some fields visible, some hidden, some readonly etc.
Hope this helped.
Best regards,
Łukasz