Ensuring empty rows are not inserted

Right now, the InsertRow does not have any way to tell if the data that it is inserting is valid or not. For example, the user might click on the SendRSVPButton by mistake and that will insert a blank row. We can fix this by checking to make sure that the guest has typed in at least the name before we insert anything.

To achieve this, we can place all the blocks that we created within an if /then statement. The condition that we will check for is whether the NameTextBox. Text is empty or not. If the NameTextBox.Text is not empty, then that means the guest must have typed something and we will allow the insertion to happen. "If the NameTextBox.Text is empty, then the if statement is not true, and the then set of blocks will not fire. As a result, nothing will happen. The following screenshot shows the blocks for the if statement:

Ensuring empty rows are not inserted

You can find the lime-green (unequal) block in the Build In Logic Block drawer. The block will appear with an equals sign, as follows:

Ensuring empty rows are not inserted

Click on the arrow and select the unequal option from the drop down menu. In the first blank, insert the NameTextBox.Text block and, in the second blank, insert a blank Text block. Now our code indicates that, if the name field is not blank, then it should get the data and insert it into the Fusion Table.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset