How do you check if multiple textboxes are empty or not?

I have a Bill Details Entry app where on the screen there are 10 textboxes for input from users ,also there is a 'Next button' when clicked takes user to the next screen . Now I want to write a 'Procedure' : it should check if user has filled all the textboxes then only move to the next screen . The problem is if how do I use a condition block like 'if' , how do i check multiple textboxes at one time
e.g If 'textbox1.text not equal to null and textbox2.text not equal to null ..... for all the textboxes and return 0 or 1 (for all null or not)

Have you read Chapter 18. Programming Your App to Make Decisions. and Chapter 21. Defining Procedures

If textbox1.text is empty and textbox2.text is empty ... then= do something using the Logic and Blocks might be how you want to test. (What do you mean by return 0 or 1 (for all null or not)? Do you intend to set all the Textboxes to some value? ) if all the textboxs are empty, then use the If then block to do your screen change.

Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here and the aia files for the projects in the book are here:

How to do a lot of basic things with App Inventor are described here: .

Also look here and here for more tutorials.

Hi ,thanks for the prompt reply , Return 0 or 1 would be :1= if all textboxes have input then i am passing data to TinyDB (that coding is done already ) and 0=if data is not there in any 1 or multiple textboxes then need to highlight the textbox with empty field and say it through a label that 'Please fill all the textboxes '

Also I checked the links you have provided : couldn't find the First And operator like the one shown here :

, can you please pinpoint the proper location for that operator

You can change the look of the blocks. Look at this example. Right click on the block.

Peek 2020-07-22 15-05

1 Like

It is time for you to read the ebook on how to code I think or to post the blocks you tried.

In read about image

Tests whether all of a set of logical conditions are true. The result is true if and only if all the tested conditions are true. When you plug a condition into the test socket, another socket appears so you can add another condition. The conditions are tested left to right, and the testing stops as soon as one of the conditions is false. If there are no conditions to test, then the result if true. You can consider this to be a logician’s joke.

What you intend to do is complex.

code like the above
might highlight the first (or actually the last) of many unfilled TextBoxes (it won't trap all). There are probably better ways you can discover what works. Enjoy exploring.

1 Like

Thanks a lot , could have used this - seems much more simpler ,however I ended up trying this before I got your reply : using a variable to track textboxes empty or not and checking its value : Don't know if it will work but let's see

... there is more to the code but ...its almost like this...editing it , will update later

Here is a way to do this with component lists ...

Did you ever find a good way to do this? I am trying to do something that I would think would be very simple but just can't seem to get it to function. I have a calculator where the user must enter 2 values. The calculation works fine and so does the code i added to restrict the range of values. The last thing I want to do I create an error message if they try to calculate with 1 or both of the text boxes blank. Any ideas what I'm doing wrong here?

@Nug0311 test for empty text boxes in a conditional statement before the out of range tests; if boxes filled then do the range tests.

Wow thanks that did the trick oddly enough the thought of doing so grazed my thoughts for a second but i dismissed it. I just need to make sure I understand why now. Just need to understand how the if/then/else if order behaves to cause the error i was seeing.

[ ]


1 Like