Hey Dmitriy, 2010/6/17 Dmitriy Igrishin <[email protected]>: > Hey all, > > I think that the current WValidator::fixup(WString& input) is not very > useful. > Suppose I've reimplemented WValidator::validate(WString& input) const (note, > WString& input, not const WString& input) and after the validation (after > the requesting the database, for example) I want to fix the users input > and I already know how to do it. > Because the WValidator::validate() declared as const, I can't save the > right input in a class variable (or I need to declare it as mutable). Also, > I can't let the fixup() to know about right input. So, because of argument > of > validate() is not const, I can to modify the input. So, I don't need > fixup()... > Summary, I think that the WValidator::fixup() will be more useful with > two arguments instead of one: > virtual void fixup(WString& input, const WString& fixed) const;
In fact, in my opinion, including fixup() in the API was a bad decision. I think it has no value in Wt (unlike for Qt). Requiring to "fixup" user input has usability issues (it is not a very common thing to see) and you should probably provide a specialized input field rather than trying to fix-up things using a validator. Still, if you would want to fixup the user input, you probably want to do it while the user is typing and entirely client-side. Then the C++ fixup() implementation is not useful either. It is a method that is on my wish-list for removal in a next major version. It is not used in any way by the library currently either (it is not never called from within the library) ! Regards, koen ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
