Modify fields only by going backwards

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
juanf11
Posts: 12
Joined: July 7th, 2020, 2:19 pm

Modify fields only by going backwards

Post by juanf11 »

Hello.-

Is there any way I can disable a field so that it's only accesable by going backwards after the first time it's filled?

I've tried many ways to go around this, including using the previous and following field to sort of "make" a loop that enables fields when going backward and so on so forth, but so far I haven't been able to be succesful.

In short, imagine these are three fields filled by Person A

FIELD_1 -> FIELD_2 -> FIELD_3

What I want to do is, after the first time FIELD_2 is completed, you can only modify FIELD_2 by going backwards from FIELD_3

FIELD_1 -> FIELD_3 -> FIELD_2 (Only if you press the back key)

FIELD_1 ----X-----> FIELD_2

I've tried using noinput, and all sort of entry order procedures to make it behave like that, but so far haven't been succesful.

Any thoughts?

Thanks.
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: Modify fields only by going backwards

Post by aaronw »

The key to this is knowing that the preproc only runs when moving forward. So you can write something like this:
preproc

    if
FIELD_2 = notappl then // or "" for strings
       
noinput;
   
endif;
When moving forward the field is advanced through (not skipped) if not empty. When moving backwards the preproc won't run, so you'll enter FIELD_2.
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Modify fields only by going backwards

Post by Gregory Martin »

You can also conditionally protect the field:
PROC FIELD_2

preproc

    numeric
moving_forward = true;

onfocus

    if
moving_forward and visualvalue(FIELD_2) <> notappl then
        protect
(true);
   
else
        protect
(false);
   
endif;

    moving_forward =
false;
Post Reply