Hide or remove a choice list value based on another list value

manibaig
Mega Guru

i have a "Request_Status" field in Request Table(sc_request) with a choice list of 5 values. I have another field on the form "state" field. If "Request_Status" field has a value "approved or completed" then user shouldn't be able to select "closed skipped" under "state" field.

client script doesn't seem to work

var request_state = g_form.getvalue('request_state');
if (request_state=='approved') {
g_form.removeOption('state','15');
disableoption('state','15');

find_real_file.png

 

1 ACCEPTED SOLUTION

Upender Kumar
Mega Sage

Hi,

 

disableoption is not a function.You have to define your own in UI Script to hide option and if you have removed the option then there is no option to disable. And write your code onChange of first filed.

 

 

var request_state = g_form.getvalue('request_state');
if (request_state=='approved') {
 g_form.removeOption('state','15');

 

Thanks

 

 

View solution in original post

4 REPLIES 4

anjaneyulumuvva
Kilo Expert

Hi ,

 

I have tried this scenario, it is working for me.you have to select UI type is All in onchange method

Gajanan Birada1
Giga Expert

Hi,

I have tried this scenario using onchange client script .it is working for me. you have to write onchange client script on request state and write remove option method to remove state field value.

 

Thank you

Gajanan Biradar

Upender Kumar
Mega Sage

Hi,

 

disableoption is not a function.You have to define your own in UI Script to hide option and if you have removed the option then there is no option to disable. And write your code onChange of first filed.

 

 

var request_state = g_form.getvalue('request_state');
if (request_state=='approved') {
 g_form.removeOption('state','15');

 

Thanks

 

 

Harshad Wagh
Tera Guru

Hi,

Please create a UI script with below code.

 

Which will help you to execute the function disableoption(), also comment the line g_form.removeOption('state','15');

 

find_real_file.png

Hope this helps!!!

 

Thanks

Harshad