Block Catalog item submit and clear the field

Tom Thompson
Tera Expert

 

I'm trying to block a item from being submitted if they state its not an Emergency by selecting No.

 

I need it to Block which its doing but I need it to clear the 2 fields and that is not working.

It worked 1 day and stopped the next

 

What is wrong here?  and will this work in the portal?

 

TomThompson_1-1726713023078.png

 

1 ACCEPTED SOLUTION

@Tom Thompson 

If you want to clear variables and also abort the submission if emergency variable is No then you should not have two return false statements in your client script.

 

You can move clearValue statements also to the If block and remove return false statement from line no-5

View solution in original post

8 REPLIES 8

Hi @Tom Thompson To achieve your requirement, you need to add a --None-- option

Sid_Takali_0-1726716556165.png

Use below code

 var emergencyExit = g_form.getValue('add_providers_emergency_request');
    if (emergencyExit == 'No') {
        alert("Testing");
        g_form.clearValue('emergency_exit');
        return false;
    }

Sid_Takali_1-1726716775699.png

 

 

I tried this it showed error but did not clear values..  Not sure what emergency exit field is. 

Hi @Tom Thompson use to clear Emergency Request field according to your requirement clearValue('add_providers_emergency_request'); 

Need to clear the date field 'When do you need this work done' and the emergency

not sure what you mean?

 

If it's Choice field you need to use backend value of No choice option in getValue() API