Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by auzette · Dec 22, 2011 at 01:22 AM · textpropertiesvalidationiphonekeyboard

iPhoneKeyboard Set Text after validation

Hello. I have a question. I'm using the iPhoneKeyboard interface to get a users sign-in name. One issue we have is that not all characters are allowed in the username, so I want to limit the input to a subset of possible characters.

In the editor, I can do this just by caching the text and drawing the textbox, testing the return value it gives me. If the two are different, then I check for illegal characters. If there are illegal characters, then I revert back to the prior version of the username and notify the user that the character is invalid.

However, in the iPad, I instead call iPhoneKeyboard.Open() and pass in the initial text, I then simply poll for the value of the keyboard and return it to my function that will do the same check as above. However, if the new username is NOT valid, then I want to modify the text in the iPhoneKeyboard buffer so it has the invalid characters removed.

I see that the iPhoneKeyboard has a .text property (that we read), and I know that i can set the text in the Open() method, but my attempts to call a kb.text = newtext do not work (and do not cause an error).

I can see perhaps security implications for not allowing text to be modified, but am curious if anyone knows if the .text property really is readonly, or have any other insight as to why I'm not able to set it directly.

Thanks for any insight.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by auzette · Jan 13, 2012 at 12:52 AM

Follow up on this, the answer is that the .text property is settable as well as gettable. The error that prompted this confusion on my part was upstream of the code I was looking at.

So I was able to validate keyboard input on iPhone and reject text that wasn't valid without the user having that text buffered on the iPad keyboard but missing from the actual text field being displayed.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Where can I find my TMP material? 1 Answer

setting iPhoneKeyboard.text (or any workaround about resetting user input) in Android. 0 Answers

How do I use custom input validation on an InputField? 1 Answer

Custom text UI 1 Answer

Why if I execute .SetText on the Start it dont works. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges