Q:
I'm tryng to use the classic "Browse" command
I I wryte:
Code:
open database southwind
use example
browse field title:c="MR.Mrs,Miss,Mr",;
last_name:w=10:V=Validate(),;
first_name
proc validate()
endproc
in the validate, how can I test the value just insert in the "last_name" field?
if I test "last_value" I see the previous value..
A:
Pass "{}" to the validation proc.
Q:
I'm trying to do validation for a Textbox field on a canvas.
Suppose I set Validation to !empty("{}") and Error to "Field must not be empty".
1. When I press the tab key, the error message appears in the yellow error dialog, but the cursor moves to the next field. Is this expected behavior? I would expect the focus to be kept on the offending field.
2. If the field is empty to begin with, tabbing through the field does not generate the error dialog. Is this expected behavior? The field fails the validation, so I would expect the error dialog to appear and focus to remain on the offending field.
3. What is the recommended approach if the validation for a field has multiple components, requiring varying error messages for the field?
4. Are there other preferred alternatives (different delegates, etc.) for doing field level validation?
A:
The Validation expression is checked on exiting the field when the field value has been modified.
This expression can also be a call to a function/procedure/prg, so you could handle your varying error messages their, e.g.
Validation: myfunc("{}")
Code:
//myfunc.prg
param fld_value
do case
case fld_value = "something"
...
You also have Section and Page level 'Valid when' delegates and the Section 'Before data update' delegate where data validation can be carried out:
All topics in [Answers] alphabetically: https://www.lianja.com/community/sho...ll=1#post13748
These answers are also systematized on the site "Lianja developer": https://lianjadeveloper.wordpress.co...ry/validation/
Bookmarks