Gene,
Thank you for the exhaustive and nicely-written enumeration of the
reasons I NEVER enter data in a grid!
The grid displays my data. Select a row and press Enter.
A record view form pops up over the grid (you can still see where you
are) and do your entry. In some cases we do consistency checking in
individual fields, in others we wait until you press the 'Done' button.
'Done' makes a final check and returns you to the browse, on the same row.
All validation is done in the View form. The Grid is read-only.
Dan
On 11/20/13 03:37 PM, Gene Wirchenko wrote:
Dear Vixens and Reynards:
I have been working on something else, and now, I come back to grids.
I have asked this question before, but not gotten an answer that
works. I am asking again just in case someone does know how to do this
or even has a good lead. I really do not want to have try to code a
workaround for this, because it is liable to be very nasty with *lots*
of events to handle.
I am also very puzzled that grids seem to be used a lot by others,
and I have not read about this issue.
The question is: How do I implement row-level validation in a
grid? If there is an error when a row change would occur, a message box
should be displayed and the row change should not be permitted. Nice:
The focus should be set to one of the controls involved with the error.
Ideally: The focus should be set to the first (from left to right) control.
I know how to handle validation for individual controls.
But at the row-level, I might have to validate that different
controls for a row have compatible values. For example, a work order
covers a span of dates. The start date must not be after the ending
date. (No, the solution is not just to swap them. It might be a typo.
The condition should get detected.)
I have been finding it difficult to get the current values of the
controls. It seems that, for a column, the last value is the value for
the last row that was touched (read as "had focus") for that column (or
the first row if the column has not been touched by the end user).
curval() does not do it. It does not get updated until *after*
the validation.
How do you do proper (for my value of "proper") validation with a
grid?
My possible solution is to touch every control on a row before
doing the row-level validation.
Ugly Point #1: This means that I will have nested row-col change
events. I am not sure if this is even possible and always have the
focus correctly placed.
Ugly Point #2: This also means that I will have many validation
events which will have to have their error checking turned off, and then
error checking will have to be turned back on.
In short, it is a recipe for hairy code. <sarcasm
style=bleak>Fortunately, due to the wonders of encapsulation, once I
solve this, I will not have to look at it again.</>
Won't you help send Gene to swan camp? I am tired of ugly
duckling camp. (Ponies are too much upkeep.)
Sincerely and admittedly somewhat desperately,
Gene Wirchenko
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.