Alarm the users about the specific fields that are not null,

Hi All,

In Servoy form IM-^Rm trying to alarm the users about the specific fields that are not null, and ask them to fill the fields with the following:
Teach, Father, Mother or Other.

I have the following JavaScript that is not working form me:

var alert = ‘’;
// from the form abc_respondent
if (abc_respondent == “”)
{
// If null display and alert box
alert(“Please fill in the field with Mother, Father, Teacher or Other.”);
// return false to stop further processing
return (false);
}
// If abc_respondent is not null continue processing
return (true);

plugins.dialogs.showInfoDialog( ‘Result’, alert, ‘OK’)

Please advise.

Thanks,

Abarhim

Try:

if (abc_respondent == null || abc_respondent == "")  {
    // do this
}

Try this:

var alert = ''"; 
if (Teacher == "" || Father == "" || Mother == "" || Other == "") 
{ 
     alert = "Please fill in the field with Mother, Father, Teacher or Other."; 
 } 
else
{
     alert = "BINGO! You filled everything just right!";
}
plugins.dialogs.showInfoDialog( 'Result', alert, 'OK')