Requestor Country Auto populate, If the Requester Location Country is not India, do not allow submit

akashvarma85310
Tera Contributor

In the Record Producer, based on the Requested for auto-populate the Requestor Country, if the Requester Location Country is not India, do not allow to submit and alert.

I wrote the code but its not working 

 

function onSubmit() {
    //Type appropriate comment here, and begin script below

    var inc = g_form.getValue('requested_country');
    if (inc !== 'India') {
        return false;
        alert('Testig');
    }
    return true;
}
2 REPLIES 2

bammar
Kilo Sage
Kilo Sage

I think you need to say  -   if (inc !='India') {   - try without the extra =

 

You could also have on change- the person selects the country ( required field)  and if they pick anything else other than India- You show a message saying you can only proceed if your in India, clear the  Country field and they wont really be able to proceed to even get to the submit button. You can even have text on top of form in Red saying this form is ONLY intended foe use in India

abirakundu23
Mega Sage

Hi @akashvarma85310 ,

Please try below code. Tested in my PDI which is working for both cases i.e not for India & India.

abirakundu23_0-1721103303977.png

 

function onSubmit() {
    //Type appropriate comment here, and begin script below

 

    var inc = g_form.getValue('requested_country');
    if (inc !== 'India') {
        return false;
        alert('Testing');
    }
else
    return true;
}

Please mark helpful & accept answer if it's worthy for you.