I'm using Oracle 18c and Apex 19.1. I'm trying to create a page validation process in APEX. I have 4 Author fields each with a first name and last name for a total of 8 author-related fields. I'd like to prevent the user from filling in only the last name, and leaving the first name blank. I'm hoping I can put the validation of the four fields into one validation process. I created the process as type PL/SQL Function Body (returning Boolean). I use the following code:
BEGIN
IF :P133_AUTHOR1_LAST_NAME is not null AND :P133_AUTHOR1_FIRST_NAME IS NULL
THEN
:P133_AUTHOR_ERROR_MSG := 'Author1 LAST name is populated but the FIRST ' ||
'name is blank. Please populate both names for a given author.';
RETURN FALSE;
ELSIF :133_AUTHOR2_LAST_NAME is not null AND :P133_AUTHOR2_FIRST_NAME IS NULL
THEN
:P133_AUTHOR_ERROR_MSG := 'Author2LAST name is populated but the FIRST ' ||
'name is blank. Please populate both names for a given author.';
RETURN FALSE;
ELSIF :133_AUTHOR3_LAST_NAME is not null AND :P133_AUTHOR3_FIRST_NAME IS NULL
THEN
:P133_AUTHOR_ERROR_MSG := 'Author3LAST name is populated but the FIRST ' ||
'name is blank. Please populate both names for a given author.';
RETURN FALSE;
ELSIF :133_AUTHOR4_LAST_NAME is not null AND :P133_AUTHOR4_FIRST_NAME IS NULL
THEN
:P133_AUTHOR_ERROR_MSG := 'Author4LAST name is populated but the FIRST ' ||
'name is blank. Please populate both names for a given author.';
RETURN FALSE;
ELSE
RETURN TRUE;
END IF;
END;
It checks the first If/Then and shows the text in Error Message when appropriate. However the code ignores the remaining 3 ELSIF statements. How do I construct the IF/Then/ElsIf statements so that it will RETURN FALSE when appropriate?