Ok, I found a bit of a work around, but still need some input.
I added a script trigger (specifically onobjectexit) to the field, and had it run a simple Commit Record script. However, now I get the error message "Commit Records/Requests has been canceled. Do you wish to continue with this script?". I tried adding a
If [Get (Last Error) > 1]
However this doesn't seem to help. Does anyone know how I can get this message to disappear?
do you have the "Set Error Capture [On]" in your script?
and under what circumstances is your script returning that error message?
Set Error Capture was on, however it still didn't matter. By the way, the get last error was set to greater than 0 as I didn't know what error was causing the message.
Basically my validation for the field brings up a custom dialogue box that tells the user the issue. I have turned off over ride and therefore their choices are "Revert Record" and "Ok". If the user hits OK, the error message appears.
I'm having some trouble with this statement in your first post:
"I want FM to validate fields as I tab or exit to another field and not when I click in white space or I switch to another record."
I've been testing any number of validation rules and they all seem to kick in when I tab or exit to another field. Can you give an example where this is not the case or am I misunderstanding the question?
I have a form with many fields on it. During data entry, when I move from one field to the next, FM does not validate the previous field. Validation rules are primary maximum number of characters, and calculation (allowing only certain values, 0,1,7,8,9). None will allow user to over ride, and most have a custom dialogue box that explains the error. I have tried selecting "Validate on data entry only" and "Always".
According to FM documentation, "Unique or existing validation on a field triggers when you exit the field, not when you commit the entire record." It seems to me that only unique or existing validation is triggered on field exit, all other validation appears to occur at record commit, which doesn't take place when you move from one field to the next during data entry on a single form.
In a test file, validation rules that verified data types such as Numeric Only and value list membership all kicked in when I tabbed out of the field. Also, specifying a maximum number of characters (with that option--not as a calculation).
Interestingly, a calculated validation such as
(Self = 0) or (Self = 1 ) or (Self = 7) or (Self = 8) or ( Self = 9)
Does not kick in until the record is committed. I can, however, define a value list of these values and test for membership in the value list as a way to have it validate on field exit.
For validation rules that don't kick in on exit, I'd write a script like this:
If [Not ( // put your validation test here )]
Show Custom Dialog ["Your error message here"]
Exit Script [False]