[Cuis-dev] validating text input
Mariano Montone
marianomontone at gmail.com
Thu Apr 3 14:09:01 PDT 2025
El 3/4/25 a las 18:05, Mariano Montone escribió:
>
> El 3/4/25 a las 14:49, Mark Volkmann via Cuis-dev escribió:
>> I'm looking for a way to validate input into a TextModelMorph. For
>> example, maybe I only want to allow certain characters to be typed or
>> I want to limit the number of characters that can be entered. I've
>> looked through all the methods in TextModelMorph and InnerTextMorph,
>> but don't see an obvious way to do this without creating new
>> subclasses of one or both of those. Am I overlooking something?
>
> I think you will have to subclass. TextModelMorph won't satisfy every
> use-case.
>
but I would look at #acceptContentsFrom: in the model, and return false
when input doesn't validate. Could be good enough for your purposes, but
not sure.
More information about the Cuis-dev
mailing list