Chekclists: rejecting blank Items

We went to a lot of work to make sure that the two Done buttons were disabled when the TextField was empty in order to prevent blank Items from making it into the checklist. However, as far as a checklist is concerned, a blank Item is equivalent to an Item consisting of only spaces.

I found it easy enough to make sure that the Done button in the nav bar remained disabled if the user only typed spaces into the TextField, but the Done button on the popup keyboard is more problematic. As far as I can tell, Apple doesn’t want people messing with the state of the Return/Done key on the popup keyboard. Did the book skip over the case where the user types only spaces into the TextField to keep things simpler?

It seems to me that in order to keep the state of the two Done buttons in sync, you might need to keep both Done buttons enabled when the TextField is blank, then validate the input after the user clicks on the button, i.e. not add the Item to the checklist if the text only contains whitespace.

Trying to prevent spaces is over-engineering in my opinion. Somebody can quite easily forget to add some text for an item and click the “Done” button and we do want to prevent that. But if somebody deliberately enters spaces, that’s their choice. So no point in trying to prevent that.

This topic was automatically closed after 166 days. New replies are no longer allowed.