Modify Form Behavior
Before we call the OpenForm procedure, we can call a helpful set of OnOpenForm_* procedures that modify the standard form behavior. This way, there is no need to modify the fields and code of the form itself.
call OnOpenForm_DisableAllFields()
We use the DisableAllFields when the fields of a form are too many, and it is better to disable all fields and then enable only a few fields we want. Keep in mind that in this case, the contents of the fields are visible to the user.
call OnOpenForm_HideAllFields()
We use the HideAllFields when the fields of a form are too many, and it is better to hide all fields and then show only a few fields we want.
call OnOpenForm_RequiredField(“fieldname“)
The RequiredField specifies a field fieldname as a required one. The form does not save to the database until the user has filled in the field with data. The prompting label of the field becomes bold to notify the required of the field.
call OnOpenForm_SetValue(“fieldname,val,displayval“)
The SetValue presets the value of a form field fieldname to the value val. If the fieldname represents a lookup field (foreign key), then the displayval is also required. (the val, in this case, is kept internally while the displayval is displayed)
call OnOpenForm_EnableField(“fieldname“)
If the developer uses the DisableAllFields, then the EnableField enables the fieldname field of the form.
call OnOpenForm_ShowField(“fieldname“)
If the developer has used the HideAllFields, then the ShowField becomes visible in the fieldname field of the form.
call OnOpenForm_ShowNotes()
That call shows the notes frame.
The right-sided form’s menu shows typically that.
call OnOpenForm_HideField(“fieldname“)
The call of HideField hides the fieldname. Developers use it when the fieldname’s value is required to keep it out of the user’s sight.
call OnOpenForm_HideControl(controlname)
This call hides the control of the form with name controlname.
The example code below shows the usage of those procedures.
{..................................................................................New Request}
start_bpm_activity “New Request“
start_bpm_subactivity “Define new request‘‘s elements“
rec = bpm_getrecid()
call OnOpenForm_RequiredField(“YPEYTH_MELETHS“)
call OnOpenForm_SetValue(“TYPE_AITHM_D,2,3333“)
call OnOpenForm_SetValue(“YPEYTH_SYL_PORON,111111“)
call OnOpenForm_DisableField(“YPEYTH_EKTEL“)
call OnOpenForm_DisableField(“TYPE_AITHM_D“)
call OnOpenForm_HideField(“YPEYTH_MELETHS“)
if rec = 0 then
call OpenFormModal(“ptAppend“,“REQUEST02.FM“,“WORK.REQUEST“,1,“?=REQUEST“)
else
expr = strcat(rec,“=REQUEST“)
call OpenFormModal(“ptEdit“,“REQUEST02.FM“,“WORK.REQUEST“,1,expr)
endif
end_bpm_subactivity
end_bpm_activity