#1177: enhance field validation
-------------------------+--------------------------------------------------
Reporter: aecker | Owner: somebody
Type: discussion | Status: new
Priority: minor | Milestone: 0.8.3
Component: biz | Version: 0.8.4
Resolution: | Keywords: field validation
-------------------------+--------------------------------------------------
Comment (by ed):
{{{
(1) validation on each call to ctrl.flushValue() to prevent invalid data
in cursor record (even on checkbox and other ctrls) to be implemented
like in dDataControlMixinBase._lostFocus() (maybe redirect to).
}}}
Perhaps just change the individual calls to flushValue() to call the
_lostFocus() method instead? If we did that, I'd prefer renaming that
method, but I can see the value in this.
{{{
(2) change default value of dDataControlMixinBase._inFldValid to True
(in init) and also set to True on any change of the field value (and
before revalidation) (and maybe rename var into something like
_fldInvalid) / if I dont misunderstood the implementation.
}}}
You misunderstand. The value is a flag that indicates that we are in the
middle of validating a field; it says nothing about the validity of the
field. It is used to prevent recursive calls that could potentially become
infinite loops.
{{{
(3) provide a stronger, alternativly usable method to notify user
(display box instead of statusbar notification). E.g. if the message
returned by the overwritten biz.validateField() method contains an
exclamation mark then show as message box.
}}}
That's already there. The dForm class implements a method called
'onFieldValidationFailed()' that gets passed all the failure information.
By default it just displays in the status bar. You can override that with
whatever custom behavior you like.
{{{
(4) alternativly (dending on Property value) set ctrl value back to the
old value on failed field validation or optionally mark ctrl with
lightred background color to inform user that there is still a invalid
value entered - to allow user to leave the field (lostfocus) with an
wrong value entered, maybe to instead correct another value in the same
form which is also involved in the validation result.
}}}
Again, that would be a particular implementation that may work in your
app, but not in someone else's. That's why we designed the response as a
hook method for developers to customize as needed.
--
Ticket URL: <http://trac.dabodev.com/ticket/1177#comment:2>
Dabo Trac <http://trac.dabodev.com>
Trac Page for Dabo
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]