|
Rick, Let me try to answer this one; "Validation" in entryfield is kind of a misnomer cause it consists of 2 parts: 1. what's valid(comparison, range etc. defined in the validation page) and 2. the message to put up if invalid when being validated(also defined in the validation page). So filling up both doesn't mean that the entryfield will get validated. What's happening is this; when you do a getatr(inside of your lostFocus action subroutine), if the field content is invalid based on #1 above, you'll get a runtime error(and before that a "a value is invalid" warning). You get both. If you have defined validation(action), for M2 or before that, the only choice to get a validation action is by using a button(button properties notebook - action - validate then perform action). If such a button was defined and pressed and the contents are invalid, then you'll see the validation message that you've defined popped up in a message box, and addtional behaviour like the field got reversed video and focus sent back to it etc; this is the validation action. Now in your case, you apparently were trying to do both; I mean you want to do validation yourself but you also want to partially get validation from VARPG(range/message defined but no validation button). And because it was done thru' a 'lostFocus' event and when we were trying to put up the runtime error message(the second message that you never see, the first one being 'a value is not valid'), the focus has to be taken away from the ID field again, another lostFocus event was triggered thus leading to infinite loop. In the next release(M3), we have added a 'auto-validate' style for entryfield and that's done automatically thru' lostFocus event(with additional effort from our runtime engine to prevent looping), and I think that would solve part of the problem. But I believe there's still room to improve; no matter which version M2/M3 you're using, we are saying EITHER you do validation yourself; don't define range/message in the validation page, your code should handle checking and visual effects, OR you can use our validation(define range/message, define validation button(M2), auto-validate style in the field itself(M3) and you have to accept our way of controlling the visual effects( messagebox, reversed video). There's no way to try to integrate our validation with additional behaviour/visual effects from you. I think here's what we should do; maybe add (one or two) runtime attribute(s) that allow you to request a validation and basing on the result; on one attribute we'll just return true/false and you'll do the rest-visual effects etc.; and the other attribute will also return true/false but if it's invalid, the VARPG engine will still go thru' our visual effects first. Well, that's only my 2 cents. Hope I've answered your question. Thanks. Alan Chao "VisualAge RPG" Development IBM Toronto Lab. 1150 Eglinton Ave. East North York, Ont. Canada Tel: (416) 448-6086 e-mail: alanchao@CA.IBM.COM ---------------------- Forwarded by Alan Chao/Toronto/IBM on 03/10/2000 01:10 PM --------------------------- Phil Coulthard 03/09/2000 09:54 PM To: alan chao, wilson hui, Ida Yung/Toronto/IBM cc: From: Phil Coulthard/Toronto/IBM@IBMCA Subject: Problems with validation messages on VARPG projects fyi Phil Coulthard, AS/400 AD, IBM Canada Ltd. coulthar@ca.ibm.com. 416-448-4076 ---------------------- Forwarded by Phil Coulthard/Toronto/IBM on 2000/03/09 09:53 PM --------------------------- "Flagler Jr., Richard E." <flagler@timken.com> on 2000/03/09 06:10:41 PM Please respond to CODE400-L@MIDRANGE.COM To: "'CODE400-L@midrange.com'" <CODE400-L@MIDRANGE.COM> cc: Subject: Problems with validation messages on VARPG projects I am teaching a class in VARPG and one of the students brought a problem to my attention. I was able to readily duplicate it. I get a VARPG generated validation message that I can't get out of without killing the program. I'm not sure if the technique I am using is right. Here's the steps to recreate this and i'll attach the ODF, TXM file and VPG code for the errant program in case anyone wan'ts to try it. 1. create a window with two entry fields and a radio button 2. open properties for field1, a character (30A) field and add a validation message if it's NE blank (' ') and attach *MSG0002. 3. open properties for field2, a numeric field (9,0) and add "range" validation for between 1000 and 59999 and attach *MSG0001. 4. code and action subroutine on the numeric field so that when it looses focus, check if the numeric field is under 50000 and if so, check the radio button. 5. code an exit button for eval *INLR = *ON. The problems are: 1. When compiled, if you enter 1 in the numeric field and click somewhere else to make focus be lost, a system supplied validation message appears that isn't the *MSG0001 that I coded. Further, it won't go away and sometimes is duplicated so that there are two error messages. Maybe there's a conflict between the concept of lost focus and the error message display? Could that be? 2. Not sure why, but it also appears that the character validation field NEVER gets checked. I thought as soon as you "left" the field, the validation "fired". Am I wrong about that? This program is one of the examples in the IBM supplied Partners in Education curriculum and so potentially a lot of people might try to do it. FYI, I'm on V4R4 of OS/400 and V3r2m2 of VARPG/CODE and SP002. Any thoughts on this would be appreciated. My students think they've found a bug in VARPG but I wonder if the usage of LOSTFOCUS and validation is a problem. Thanks to all. ---------------------------------------------------------------------- Rick Flagler Manager, Information Systems Timken Super Precision (MPB) Keene, NH 03431-0547 p: (603) 352-0310 x207 f: (603) 355-4534
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.