2017년 7월 28일 금요일

Capitalize First Letter.


I would like to know how to capitalize the first letter in a user ID input text box.  Eg. Change a01234 to A01234 when user types in the ID.
 My understanding is that I would most likely need to place a Procedure in my When TextBox1 .Got Focus block, But not sure how to achieve it.
--
you might want to use the TextUtils extension from Appybuilder

--
There's no Submit button?
That's typically where you would put cleanup and validation.

Also, if the only alphabetic character in the user ID is the first one,
you can just set Textbox1.Tex to upshift(Textbox1.Text) (in the text blocks, maybe different name)

BTW, that's an awful name for a Textbox.
You can rename it easily in the Designer, and every reference will follow.

--
Also see post here:
--
(added to Text section of FAQ) FAQ for text

--
Celebrant_Connection is actually the submit button which which calls the URL. I have now renamed to Connect to comply with your comment. :-)  I will experiment with your comment regarding resetting TextBox1.

-- 
Thank you for the tip.  I have had a look at the TextUtils Extension and it has some interesting capabilities.  Is it possible to download the extension and use it in App Inventor2?

--
Yes, it works with MIT AI2. 
Extension link is at bottom of blog post: TextUtils extension

--
I have downloaded and installed the extension.  I just need to work out how to apply it to my blocks so that when the user inputs the ID with the first letter in lowercase into the text box, the extension will automatically convert it to upper case. 

--
This can be very simple Ivan.
The above blocks will change a01234 to A01234  , place these three blocks immediately prior to executing your sign in but after 
the user types all the pass code. and before he/she presses the 'execute' button or whatever it is called.

This simple code will work for you because you only have a single alphanumeric character that needs changing; upcase will leave the numerals unchanged.

--
Steve, the upcase will convert all alpha to upper. It'll work for a01234 to A01234, but not when word has multiple alpha chars. However, given @Ivan's requirement, it may be sufficient for him.

--
FYI, see attached that shows result when using TextUtils.TitleCase.



--
@ Hossein      Hi.   Correct, upcase converts what Ivan wants using native AI2 blocks.   No reason for him to deal with loading an extension. Native blocks in this 
case results in a cleaner app because all his sign in codes have the form  A1234.

--
Yes, you are correct.

--,
Sincere thanks, 
That code worked fine, I was on the right track myself but was putting the code in the wrong block.
All sorted.  Ivan :-)

-- 
Thank you for your help.  Steve's idea worked for me, as I said to Steve I had it right but in the wrong block.
I now have the Text Utils extension installed so I am going to have a play with it.

-- 

댓글 없음:

댓글 쓰기