Set mandatory fields inside MRVS for a specific field

GhitaB
Tera Contributor

actually i have another issue that i need to set some mandatory fields inside that MRVS ,problem i'm facing that it worked when i remove the country condition cause the subject country exist in the catalog item and i guess it's not getting catched inside the modal of the MRVS what to do in the case cause i need to make them mandatory for a specific country

2 REPLIES 2

Chaitanya ILCR
Kilo Patron

Hi @GhitaB ,

 

is subject_country variable/field is reference type or choice type

 

just put an alert and check what value you are seeing  if it is a reference type you have to compare with sysid

 

function onSubmit() {
    var country = g_form.getValue('subject_country');
    alert(country);

    if (!country || country.toLowerCase() != 'australia')
        return true;

    var emergencyName = g_form.getValue('emergency_name');
    var relationship = g_form.getValue('emergency_relationship');
    var address = g_form.getValue('residential_address');
    var eCountry = g_form.getValue('emergency_country');
    var mobile = g_form.getValue('phone_mobile');

    if (!emergencyName || !relationship || !address || !eCountry || !mobile) {
        spModal.open({
            title: "Missing Information",
            message: "Please complete all required Emergency Contact fields before adding the row.",
            buttons: [{
                label: "OK",
                primary: true
            }]
        });
        return false;
    }

    return true;
}

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

Harmeet2Singh
Tera Expert

Hi,

try using below:

if (!country || !(country.toLowerCase() == 'australia'))
 
else can you try 
var country = g_form.getValue('subject_country').toString();
 
if still not, try
var country = g_form.getDisplayBox('subject_country').getValue();