2014년 12월 13일 토요일

Removing empty space from textbox

I have designed a login system for my app where the user registers with a user name and password. The user name and password are entered into text boxes and a button is pressed to save them in tinywebdb.

Here is the problem. I noticed that the auto correct of my phone sometimes inserts a space after the user name. So if I want to register with the name "abc", I unknowingly create the user name "abc " (ending with a space or empty string). So when I try to login without the space I receive an incorrect user name error. How do I make sure that the empty spaces in the user name text box are not saved as the the user name? 

I tried using the attached blocks but they always result in the error if I dont use spaces.




Use the Trim block from the text drawer...



Thanks! I feel so stupid. Don't know how I missed something so obvious after having used app inventor for some time.



No problem... Very often, the hardest things to find are the ones right there in front of us ;)!


댓글 없음:

댓글 쓰기