Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Is it possible to limit characters in TextInputDialog only with letters from English alphabet? — Gideros Forum

Is it possible to limit characters in TextInputDialog only with letters from English alphabet?

romkaromka Member
edited September 2013 in General questions
And if not, what alternative to TextInputDialog can you recommend for username entering?

Dislikes: yubaro

+1 -1 (+0 / -1 )Share on Facebook

Comments

  • You can't limit entering characters, but what you can do, is to check the length of the string on complete and then display error message or go back to TextInputDialog, etc
  • tkhnomantkhnoman Member
    edited September 2013
    Yep, like @ar2rsawseen said, we can only check it after.

    This is what i do:
     
    local obtainedText = "This is a text.. 何とか"
    local _mapnamechar = "[-a-zA-Z0-9()_ !<a href="http://forum.gideros.rocks/profile/%26amp" rel="nofollow">@&amp</a>;*+='?,.<>/]"
    local checkedText = string.gsub( obtainedText , _mapnamechar, "" )
    if string.len( checkedText ) >= 1 then
    	print("Contain something else~")
    end
  • Hi @ar2rsawseen and @tkhnoman. Thank you for answers. I've decided to solve this task with transliteration string entered by user. I hadn't found such solution for Lua and wrote my own transliteration class: https://github.com/romka/lua-transliterator. It's written on pure Lua and can be used outside of Gideros.

    To use it with Gideros you should include all files from this repository to Gideros project, and exclude from execution all files from data directory, files from this directory will be included on demand.

    Likes: romka, pie

    +1 -1 (+2 / -0 )Share on Facebook
Sign In or Register to comment.