Ed Leafe wrote:
> On Mar 28, 2010, at 9:10 AM, Ricardo Aráoz wrote:
>
>   
>> The field turns red and black correctly on field validation, and it's
>> exactly what I wanted. But if I leave the wrong value and click on the
>> save button the record is not saved (that's correct) but no error
>> message from the record validation is displayed. On the basis that field
>> and record validation should be orthogonal I think there's something wrong.
>> I know it is the code run by the field validator because when I comment
>> out the validateField() method of 'recipes.py' then the error window
>> comes up as it should.
>>     
>
>       These events happen in sequence, and once a failure happens, the 
> process is stopped. Think of it this way: we know that the current field is 
> not valid, so why bother continuing to see if anything else is valid? The 
> record cannot be saved as it exists.
>
>       If the current field fails validation, the save process will stop then. 
> Normally a message is displayed in the status bar to inform the user of that 
> fact, but you've chosen to suppress that behavior.
>   
So, you mean to tell me that in the bizObj validateField and
validateRecord are two independent things but in the form they are not?
Does that mean that there is no onRecordValidationFailed() method in the
form?
I must be misunderstanding you, if the validateRecord() bizobj method
flags an error there is no way the onFieldValidationFailed() form method
can get to know which field is erroneous, and thus it cannot know the
"ctrl" parameter, so I deduced that the onFieldValidationFailed() method
would not be called, and if this method is not called then I am not
choosing to suppress any behaviour (I suppose my overriding of the
onFieldValidationFailed() is the reason you wrote "you've chosen to
suppress that behavior").
I know my argument must be wrong somewhere but I can't see where.

>       What I think you're trying to do is not say that the field is invalid, 
> but that the record with the field in that state is invalid. So perhaps try 
> moving your onFieldValidationFailed() code to the onLostFocus() event handler 
> for that control. This way you get the coloring you want without disrupting 
> the process, and when you run save(), the validateRecord() code will catch 
> the problem and display the normal error message.
>   
You mean to say I should subclass dTextBox for every control I must
validate?
Or subclass dTextBox and in the onLostFocus() ask for the name of the
control in order to call the appropriate validation function?

And I'd like to ask you if when I override the the
onFieldValidationPassed() form method to restore the control's ForeColor
to black I should call super() so as to keep intended behaviour.

Thanks.



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
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