andy2609
18th January 2019, 17:45
In a 4GL program script, where multiple form fields require the same checks, is there any way to use wildcards to avoid replication of code for each field? I have a form with 20 data fields of the same type.
Here is a sample of what I would like to avoid having to create for each field:
field.field_01:
before.checks:
field_01 = toupper$(field_01)
check.input:
if not isspace(field_01) then
if not valid.entry(field_01) then
set.input.error("")
endif
endif
field.field_02:
before.checks:
field_02 = toupper$(field_02)
check.input:
if not isspace(field_02) then
if not valid.entry(field_02) then
set.input.error("")
endif
endif
Here is a sample of what I would like to avoid having to create for each field:
field.field_01:
before.checks:
field_01 = toupper$(field_01)
check.input:
if not isspace(field_01) then
if not valid.entry(field_01) then
set.input.error("")
endif
endif
field.field_02:
before.checks:
field_02 = toupper$(field_02)
check.input:
if not isspace(field_02) then
if not valid.entry(field_02) then
set.input.error("")
endif
endif