Last field behavior.

rob bradford

New Member
I have to do some vaildation on the last field in a frame using an on leave trigger, this works fine as long as the field firing the validation trigger is NOT the last field in the frame, otherwise all sorts of strange things happen.

def var ws-contact as char format "x(25)".
def var ws-cont-email as char format "x(60)".
def var ws-cont-tel as char format "x(14)".
def var ws-cont-mobile as char format "x(14)".
def var ws-cont-flag as log.
def var ws-cont-date as date.
def var ws-cont-time as int.


form ws-contact skip
ws-cont-email skip
ws-cont-tel skip
ws-cont-mobile skip
ws-cont-flag ws-cont-date ws-cont-time with frame f-frame side-labels.


ON LEAVE OF ws-cont-email IN FRAME f-frame
DO:
IF LENGTH(ws-cont-email:SCREEN-VALUE) > 0 AND
INDEX(ws-cont-email:SCREEN-VALUE,"@") = 0
THEN
DO:
message "duff address" view-as alert-box.
return no-apply.
end.
END.

ON LEAVE OF ws-cont-flag IN FRAME f-frame
DO:

if ws-cont-flag:SCREEN-VALUE = "no" THEN RETURN "".

IF ws-contact:SCREEN-VALUE = "" THEN
DO:
message "no-contact!" view-as alert-box.
ASSIGN ws-cont-flag = FALSE.
DISPLAY ws-cont-flag WITH FRAME f-frame.
APPLY "ENTRY" TO ws-contact IN FRAME f-frame.
RETURN NO-APPLY.


END.

IF ws-cont-tel:SCREEN-VALUE = "" AND
ws-cont-mobile:SCREEN-VALUE = "" AND
ws-cont-email:SCREEN-VALUE = "" THEN
DO:
message "Other fields empty" view-as alert-box.
ASSIGN ws-cont-flag = FALSE.
DISPLAY ws-cont-flag WITH FRAME f-frame.
APPLY "ENTRY" TO ws-cont-email IN FRAME f-frame.
RETURN NO-APPLY.
END.

ASSIGN ws-cont-date = TODAY
ws-cont-time = TIME.

DISPLAY ws-cont-date
STRING(ws-cont-time,"HH:MM") @ ws-cont-time
WITH FRAME f-frame.
END.

display ws-cont-flag with frame f-frame.
enable ws-contact
ws-cont-email
ws-cont-tel
ws-cont-mobile
ws-cont-flag
ws-cont-date with frame f-frame.

wait-for "go" of frame f-frame.


pause 100.




To see the error in action replace the enable statement in the above with the following;

enable ws-contact
ws-cont-email
ws-cont-tel
ws-cont-mobile
ws-cont-flag with frame f-frame.

Any ideas or workarounds?

HP-UX 10:20
Progress 8.3b

Rob.B.
 

Serj HAMMER

Junior Racer
try to do validation on "GO"

Hello, Rob. I have one idea about You.

In Your situation the best way is to move all validations to the trigger "ON GO OF FRAME f-frame". Because before wait-for terminated - trigger fired. Any field may be last, but trigger work well. Second advantage is pressing F1 ("GO" button) in any field of frame. In this case wait-for terminated and You can-not check form value using "ON LEAVE" triggers (You check only current field), but trigger "ON GO OF FRAME" check all form fields with their interaction.

Try to add this to Your code:

ON GO OF FRAME f-frame DO:
  MESSAGE "Validation" VIEW-AS ALERT-BOX.
END.

I have installed 9.1C on Linux and can-not repeat Your situation. All cases work well. IMHO it is future, that You do not have in 8.3b.
 
Top