Re: [Wt-interest] Sub-Classed Validator
Archimedes B. Cortes <
acortes@...>
2008-06-02 07:31:18 GMT
I was looking for a functionality in wt that would allow say:
I have WRegExp reg("ABC") as a validator, a textbox will only allow me
to enter characters that satisfies reg, and not show red as in the case
of Wt textboxes.
I am currently also looking into sub-classing the WLineEdit or
Ext::LineEdit instead.
Well, if what you've suggested below will come up with the same effect,
why not. At least, we have that function. :)
Koen Deforche wrote:
> Hey Archimedes,
>
> 2008/5/29 Archimedes B. Cortes <acortes@...>:
>
>> I'm trying to come-up with a validator that will catch every input
>> character and filter it if it's not valid (will not show on say a text
>> box). A similar class from other lib that I've used before allows this
>> and not the current behavior of showing a red on a textbox when
>> validated. I usually re-implement validate(input, pos) and manipulate
>> the input and pos. I understand that in WValidator's case I may do it in
>> javaScriptValidate(). I've already tried, but since I'm not yet familiar
>> with the underlying script code, every attempt is still unsuccessful.
>> Can you help me with this one? Or is there an easy way?
>>
>
> In principle, yes, you should do this in javaScriptValidate(), but
> that validate function does not support manipulating the input (it can
> only return whether it is valid or not).
(Continue reading)