TextBox type does not do anything. Bug?

I remember tackling the validation problem a few years back. Before text fields got their type, possibly before Data Binding. Nice framework, able to notify users on a field-by-field basis of entry errors.

It was built around custom components.

  • The component provided both a wrapped text field and a hidden notification area, that would expand into view when needed.
  • Validators were plug-in functions that could be chained, customized, and composed. So were
  • “cleaners” (to remove junk pasted in from PDFs, such as currency signs, spaces, commas, tabs, … just before validation, so entry could include them)
  • formatters (to add them back in for display once the user left the field)
  • data converters (to convert text to/from int, float, date, time, … or your own custom type)

Alas, it’s not forward-compatible. It would never work, as-is, with the current field types. A number field does not accept formatting characters at any time. Pasting in a formatted number (e.g, “$12,345.67”) throws the entire string away. It doesn’t even preserve the digits! But if you leave the field type as text, instead of number, then the wrong keyboard pops up on mobile devices.

My library was a nice design at the time, but it doesn’t fit today’s underpinnings. I haven’t attempted to bring that library up-to-date. In the next month or two, I may have time to work on a modern version, but no guarantees.

2 Likes