Problem of Alert disappear without waiting user confirms

I am a newbie to Thunkable X. I tried to create a simple app that ask user to input name and year of birth, and return a message with the input name and calculated age.
Before composing the message, I test whether the 2 “TextInput” are blank and show alert if any of them are blank.
My problem is when both input are blank, the 1st alert disappears before I confirm and the 2nd alert shows waiting for confirmation.
I run Thunkable Live on an android phone. Could somebody tell me what’s wrong with my code, or is it a bug in thunkable x?

The code is as follows:

Hello

Use one block “if + else if + else if”, I think it will work

It is not a bug in Thunkable, it is the way you programmed it.

If txt_Name is empty, then you want an alert. But right after, your logic checks and reports for txt_BornYear being empty as well; with the second alert then competing with the first for the display.

How would you want it to proceed? If the txt_Name is empty, to stop processing because there is reason enough to report?

It is all under your control.

Abdelrahman1, thanks for your help. It does work. But I intend to show the 2 messages one by one. With the amendment you suggest, only one message will be shown.

Besides, shouldn’t the Alert waits for my confirmation before going on in the first instance? Sorry for keep on asking, but I just want to learn more about how each component works.

No, it should be “if else”. The Err flag is enough to adequately pass the the condition of everything being OK for the processing.

I’m not sure what you mean by “second alert competing with the first for the display”. I just thought that the first alert will wait for my confirmation before going on to execute the following statements, i.e. compare the second field and show alert if needed.

No, the waiting for the confirmation is the sub-block “then do when Show is done”, which you may populate with other things.

For instance, you could put the second “if” test in a procedure, that you would call inside that first alert, and in an “else” condition to to the first “if”. If the first est fails, then it will wait for the confirmation before calling the second. And if the first test is a pass (name is not empty), it will immediately move on to the second test by calling the procedure for the second test.

Thanks guys, I got it works now. I moved the 2nd comparison and alert to the “then do” socket of the 1st alert, and got the 2 alerts showing one by one.

Thank you very much for wasting time to answer my silly question, now I understand more about how alert works.

Warning: by moving (as opposed to having duplicate calls to, or duplicate second “if”) the second “if” inside the first “if” alert, it will not be tested when the name is not empty but the year is wrong.

Thank you for your reminder. Immersed in finding a way to show both alert, I forgot to test the situation you mentioned. I think I will try your approach of using a procedure.

Welcome
Ok I think i understood u

I have a solution but it will use more blocks
Use (if and else) to check your first case
In “if” part, put the alert, inside the alert put the second “if” block

In “else” part, put the second “if” block again