Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Allen1 Absent Member.
Absent Member.
1300 views

Field Validation

Jump to solution

Hello All,

I am trying to resolve how to validate a text box (field) immediately after entry and to determine if the content is invalid. And if it is, to return the user to that field. I have tried  using the various "validation" properties ending only in the field trying to validate itself on every character to the field trying to validate itself constantly ect...

What is the "new way" for the following "old way" of administering immediate field validation after the user has finished entering and before moving on to the next field.

Here is the "old code"

Sample procedural (linear) code


       AF25.
           ACCEPT TRN-ACCT-NO,      LINE 03, POSITION 25
                                    PROMPT, ECHO, UPDATE
                                    ON EXCEPTION ERR-CDE
                                    GO TO ERR-EXCEPTION.
           MOVE TRN-ACCT-NO TO CUS-ACCT-NO.
           PERFORM VERIFY-CUST THRU VC-EXIT.
           IF WS-REC-FND = "N"
              MOVE "INVALID CUSTOMER !" TO ERR-MSG1
              MOVE "Strike Any Key To Continue" TO ERR-MSG2
              PERFORM DISP-ERR-WIN THRU DEW-EXIT
              GO TO AF25.
              
       AF26.
           ACCEPT.............(NEXT FIELD)

I realize that I can validate all fields at once based on a given event... That being said,  it would be helpful to be able to handle it immediately as well.

I am old ! So please be as explicit as possible in your example as I am still a newbie when it comes to event driven logic. Thanks in advance for your answers they are greatly appreciated.

Allen

0 Likes
2 Solutions

Accepted Solutions
Highlighted
Austin1 Honored Contributor.
Honored Contributor.

RE: Field Validation

Jump to solution

In general, Yes, I have used the "Leave" event as the approach for doing validation of the contents of a textbox, and I would recommend this approach, assuming no extenuating circumstances.

0 Likes
Allen1 Absent Member.
Absent Member.

RE: Field Validation

Jump to solution

Thanks Rusty... The "Leave" event does the job... Sometimes I can't see the forest for the trees... Happy Easter

0 Likes
4 Replies
Allen1 Absent Member.
Absent Member.

RE: Field Validation

Jump to solution

I am not sure if I found it... but could it be the "Leave" event and then if my validation failed I could set the focus back to the field or set the focus to the next field ?

0 Likes
Highlighted
Austin1 Honored Contributor.
Honored Contributor.

RE: Field Validation

Jump to solution

In general, Yes, I have used the "Leave" event as the approach for doing validation of the contents of a textbox, and I would recommend this approach, assuming no extenuating circumstances.

0 Likes
Allen1 Absent Member.
Absent Member.

RE: Field Validation

Jump to solution

Thanks Rusty... I will it try today... and post results... Thanks Again  Allen

0 Likes
Allen1 Absent Member.
Absent Member.

RE: Field Validation

Jump to solution

Thanks Rusty... The "Leave" event does the job... Sometimes I can't see the forest for the trees... Happy Easter

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.