3
  • Is there some easy way to restrict TextInput to accept decimal numbers in range -99.999999 to +99.999999 ?

it is Spark TextInput.

Yordan Yanakiev
  • 2,546
  • 3
  • 39
  • 88
  • I am looking for something as possible without additional checks and etc, could be just ready component, something like TMaskEdit in Delphi - which need to be setted the mask, and there is no need of additional checks. like 00.000000 ... – Yordan Yanakiev Jun 10 '11 at 06:40

1 Answers1

2

You didn't specify a Spark TextInput or an MX TextInput. You can use the restrict property to prevent people from entering numeric values (and the period). It is available on both the Spark and MX components. Here are the Spark Docs.

After that, use a NumberValidator to validate the range, setting the min value and maxvalue.

JeffryHouser
  • 39,401
  • 4
  • 38
  • 59
  • I tought there is easier way than handling and checking all the time :|. Isnt there something like in Delphi - TMaskEdit, which cahn just be handled the mask and the component will do the rest ? – Yordan Yanakiev Jun 10 '11 at 06:39
  • 2
    @Yordan Yanakiev I don't know about Delphi. What type of syntax can you use to specify upper, or lower, limits in a 'mask'? Given what you need to do, why not use a NumericStepper or a Slider? – JeffryHouser Jun 10 '11 at 12:41
  • nope @www.Flextras.com the both components is not good enough, i wish to more restrict the user input and offer him better control over what he is writing, at the moment of writing it. – Yordan Yanakiev Jun 12 '11 at 18:31
  • 1
    @Yordan Yanakiev I do not understand why the NumericStepper or Slider are not good enough; but if you're intent on using a TextInput; you should use the restrict, with a validator (as I previously stated). If you want to give the user feedback as they type, you can run the validator in response to the key up event on the textInput. – JeffryHouser Jun 12 '11 at 20:48
  • the user shall have a option to enter the value he wanna, so Slider is not an option. NumericStepper neither, because it have the same issues as TextInput. only option is some sort of mask textinput, which seems unavailable atm, but it is actually one really significant ui component for a serious applications. – Yordan Yanakiev Jun 12 '11 at 21:01
  • @Yordan Yanakiev Well, if you have a formal spec and are looking for someone to build this for you, feel free to drop us a line personally and we can discuss options for implementation: https://www.flextras.com/index.cfm?event=ContactForm . It seems to me you have very competing requirements, though; that the "User can input anything" while also restricting their input to numbers (and a decimal) with upper and lower numerical limits. – JeffryHouser Jun 12 '11 at 21:19
  • my requirement is a very low, this is the bottom line component for a normal work with a numerical, decimal values into a normal applications, i can not afford paying about anything, so i better abandon the topic and look about something free. – Yordan Yanakiev Jun 12 '11 at 21:57
  • i did not understand why you have vote against my closing the topic, after you were not about to answer it ? – Yordan Yanakiev Jun 12 '11 at 22:33
  • I didn't vote to close to your topic, nor did I vote against closing the topic. I flagged the answer you entered (and selected) as "invalid" Because it was not an answer to the question; it merely said "Thanks, I'll look elsewhere." How will that help future readers of the question? I'll also point out that I did answer your question; and spent quite a lot of time conversing with you on it. I do not understand why my proposed solution does not meet your needs. – JeffryHouser Jun 12 '11 at 22:46
  • You said : " drop us a line personally and we can discuss options for implementation: flextras.com/index.cfm?event=ContactForm " - which usually means a paid service. I can not pay anything atm, because i am personally not sure if i ever shall been payed about my application. This were the main reason. – Yordan Yanakiev Jun 12 '11 at 22:51
  • @Yordan Yanakiev My proposed solution is not to "hire me" although I did provide that as an option after extensive conversation. My proposed solution is use components designed for numerical input (NumericStepper/Slider) or the use the restrict property on the TextInput and some validation. I do not understand why those are unacceptable to you. – JeffryHouser Jun 12 '11 at 23:31
  • O ... well .. then it were a missunderstanding. I am sorry about it in such a case. – Yordan Yanakiev Jun 12 '11 at 23:39