On Mar 27, 2010, at 3:40 PM, Ricardo Aráoz wrote:

> There's a couple of things I want to do though and haven't found how to.
> a) I'd like to do both, field validation and record validation. But I'd
> like that when the field validation fails to set the corresponding edit
> window object's foreground colour to red and let the user continue editing.

        You should override the form's default behavior on failing field 
validation. That method is onFieldValidationFailed(), and is passed the control 
reference, the DataSource, the DataField, the value and the error. This method 
by default displays the error in the status bar and then re-sets focus to the 
control in question. If the control is the edit field, you could set the 
ForeColor and simply return, so that the focus remains wherever the user placed 
it.

> b)I've noticed that when using field validation it will not let the user
> exit the field with invalid data but it will let the user change record
> without saving. When this is done though the invalid field value is kept
> in the grid until the user asks for a requery. I'd like that if the user
> moves to another record without saving his changes those changes be lost
> and the original value kept. Where can I do this?

        Probably the best place would be in the bizobj's beforePointerMove() 
method. This is called before any navigation method fires, and you detect 
invalid data, you could call self.cancel() from that point and the original 
values would be restored.


-- 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