validation - Validating User Input for Letters -


I am trying to validate a user input recently so that only letters of the alphabet are accepted, I How do I do this? I know how the user input is valid for most things, but this one line of code for the letters is actually bothering me.

itemprop = "text">

You can check the contents of a field with this function:

  function String Return Match Text (Valid, String, "^ [a-zA-Z] + $") is valid  

^ [a-zA-Z] + $ < / Code> is a regular expression ^ indicates the beginning of a string, the brackets determine the same character and a set of expression characters within the bracket. + means that all the following characters will be equal to the preceding (set) character (s). The end of the string indicates that in other words, according to this expression, one should be one of all the characters and it will include z or A and it will include Z.

matchText () is a LiveCode function, which checks that the string in the first parameter matches the regular expression in the second parameter. Call the valid () function anywhere on the card or stack level and call it in a rawKeyUp handler:

  at rawKeyUp If not valid (my text) then beep answered "Sorry, this is wrong" end if end raw KYE  

You can also check already:

< If the key is valid (theKey) on the keydown then the end of the end if the end key is

This method is a bit verbose in your field Of You can insert the mail text function in the handler.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -