Field validation (OpenInsight Specific)
At 18 FEB 1999 06:08:50PM Terry Evans wrote:
I'm sure it me, BUT how does anybody validation a fields value using data-aware controls. It appears that gaping holes in the OI/Windows interface allow user to enter any crap they want to and the application can NOT fix-it/stop-it/ or even warn the user about it. I'm currently using control validation to try to ensure data is correct, But if you cancel the window the system will ask to save the data (ignoring any/all validations!, no lostfocus!)? What gives? Is this another "Trap 12+ different events, cross your finger, warn the user about not doing anything wrong, and I can catch most errors."
At 19 FEB 1999 09:33AM Don Bakke wrote:
Terry,
It must be the way your are implementing data validation or somehow you are bypassing the logic when you are closing your form. You will get a savewarn message but even if you say "yes" to save the record the data validation logic will come back and abort the write.
It is a fairly straightforward mechanism. You can either indicate your validation (and output conversion) in your dictionary and then select "Default" in your control properties or you can simply specify the prefered validation in the control properties dialog.
At 20 FEB 1999 10:53AM Nick Stevenson wrote:
I suspect that Terry is not talking of the type of validation/conversion that is entered on the dictionary or control property. You very often have validation specific to the form context - such as if field "A" has value "ABC" then field "B" must have value "123" - stuff that cannot easily be done via the dictionary, and is done on the lostfocus of a control.
It would be nice if the SAVEWARN message dropped the "SAVE" option. Then we wouldn't have to catch the SAVEWARN event in the form's "CLOSE" event and change with our own message.
At 20 FEB 1999 11:34AM Nick Stevenson wrote:
Oops - Terry, I forgot to include this bit of code which you bung in the CLOSE event of your form to catch the SAVEWARN process:
declare function send_event
* stops the standard SAVEWARN event (which allows an unconditional SAVE)
* get the current focus control and issue a GOTFOCUS event to reset the DEFPROP
FocusID=get_property(@window,"FOCUS")RetVal =send_event(FocusID,"GOTFOCUS")* get the SAVEWARN status
Status=Get_Property(@window,"SAVEWARN")* check if SAVEWARN indicates a change is going to be lost
if Status thencall obj_msg_yes_no("The changes you have made will be lost. Continue?",Answer)if Answer=1 elseRETURN 0endend* set SAVEWARN property to false to stop the system process
Status=Set_Property(@window,"SAVEWARN",'0')RETURN 1
Change the msg handler (obj_msg_yes_no is my own subroutine). You can of course decide exactly what you need to do - but trapping the SAVEWARN property is your first major step. The first bit (sending GOTFOCUS) will unconditionally close the form IF THE USER HAS NOT YET PRESSED ENTER out of the field he has just changed.
At 24 FEB 1999 10:27PM [email protected] - [url=http://www.sprezzatura.com]Sprezzatura, Inc.[/url] wrote:
What sort of validation, like (D) or (MD2) or ?
I do this all the time, using the default from the dictionary or custom for the form. I've never had this fail. This is one of ARev and OI's strong points. If there were serious problems, everyone would be having them.
Could you explain this in greater detail?