Attributes of the Flex component textinput

Source: Internet
Author: User

A useful attribute restrict (constraint, restriction) of textinput In Flex is found. Let's take a look at the example below:
1, <mx: textinput id = "test_ti" width = "160" maxchars = "20" restrict = "0-9" text = "0"/>
In this way, the input box can only contain up to 20 characters and can only contain numbers ranging from 0 to 9.
2, <mx: textinput id = "test_ti" width = "160" maxchars = "20" restrict = "0-9/." text = "0"/>
In this way, you can enter numbers between 0 and 9 in the input box, and enter '.', which must be separated '/'.
3, <mx: textinput id = "test_ti" width = "160" restrict = "0-9/AB" text = "0"/>, in the input box, enter a number between 0 and 9, and a, or B.
4, <mx: textinput id = "test_ti" width = "160" restrict = "a-z" text = "0"/>
You can enter any English letter between A and Z. '-' indicates the interval. To enter '-', you must add '/', such /-
Conclusion:
The advantage of using restrict is that it saves the trouble of verification. For example, if restrict = "0-9" is added to check whether it is a number, you do not need to check it, this is because the input box can only enter numbers between 0 and 9.

 

Original document address: http://chuan315.javaeye.com/blog/233243

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.