On Mar 28, 2010, at 8:06 PM, Ricardo Aráoz wrote:

>>> So, you mean to tell me that in the bizObj validateField and
>>> validateRecord are two independent things but in the form they are not?
>> 
>>      Not really. Of course in the bizobj they are two separate things, as 
>> they are designed to deal with separate situations. But we are talking about 
>> you calling save(), which is a series of events, any one of which can abort 
>> the process.
>> 
> That was precisely my question. Does save() call both validateField and 
> validateRecord()? I understood it should ONLY call validateRecord() (if I am 
> not positioned on any field entry control). Is that so?

        Yes. The save() method doesn't call validateField() itself.

>> The problem is that you are misunderstanding the order that things happen. 
>> Before anything happens, the field validation must be dealt with.
> That would be only for the control on which I'm standing when save() is 
> issued?
        
        Yes.

> How would I otherwise override the onValueChanged() or the onLostFocus() 
> methods of a dTextBox?

        Sorry, I should look at the subject line; I forgot that you were using 
AppWizard. Maybe Paul can suggest something, but I think you are correct. I was 
thinking about a cdxml-based design, which enables you to add code to any 
method of any control directly.

        Remember, the on<EventName> methods are convenience methods only; they 
automatically bind the event to the method for the object. But you can manually 
bind events to any method handler, too:

def someHandler(evt):
        obj = evt.EventObject()
        if obj.Value == someTest()
                obj.ForeColor = "blue"
        else:
                obj.ForeColor = "red"

# Then in the code that creates the control:
txtName = dabo.ui.dTextBox(....)
txtName.bindEvent(dabo.dEvents.LostFocus, someHandler)


> Not really, you see, in my company the policy is that we do record 
> validation, but that we visually warn the user (by setting ForeColor to red) 
> on every field that's incorrect, but without interfering with his navigation 
> of the form.

        OK, then I think the use of validateField() is probably incorrect; its 
real purpose is to prevent users from ever entering invalid data in a control. 
You just want something that colors the fields based on their content, without 
preventing them from leaving the control, so the LostFocus or KeyChar events 
(depending on how immediately you need the coloring response) would be the ones 
to bind to.


-- Ed Leafe



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to