1

Hi I want to add an after field logic, I have 4 check boxes (check1, check2, check3 and check4). When I put a check mark on either check2, check3 and check4, I want to put check mark on check1 automatically. Any idea. Thank you.

MJJ3
  • 127
  • 1
  • 12

2 Answers2

1

The weakness with AFTER FIELD is that it requires you to leave the field before it is triggered.

With Genero, when we added the ON CHANGE syntax many years ago, it was implemented such that if the widget was a GUI widget such as CHECKBOX, RADIOGROUP, COMBOBOX, the ON CHANGE would be triggered when the change was made, not when the focus left the field.

We also added the UNBUFFERED input mode so that your code didn't need all those DISPLAY's scattered throughout.

You didn't state the Informix 4gl version you were using, but if you were using Four Js Genero or IBM Informix Genero (and as you said checkbox then you might be) then the answer could be ...

INPUT ... ATTRIBUTES(UNBUFFERED)
...
    ON CHANGE check2
        LET rec.check1 = "Y"

    ON CHANGE check3
        LET rec.check1 = "Y"

    ON CHANGE check4
        LET rec.check1 = "Y"
fourjs.reuben
  • 286
  • 3
  • 3
0
AFTER FIELD check2
    LET rec.check1 = 'Y'
    DISPLAY rec.check1 TO check1

Rinse and repeat. I'm assuming the input variables are in a record rec with names check1 through check4. The key is the double operation of assignment and display; you need both AFAICR or it doesn't 'work'. I could use DISPLAY BY NAME rec.check1 here, but I don't usually use DISPLAY BY NAME; I would probably include the screen record in the DISPLAY too. Under reasonable assumptions, though, what I wrote will probably work.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278