Modify Form Behavior

  • Edit

Before we call the OpenForm procedure we can call a usefull set of OnOpenForm_* procedures that modify the standard form behaviour. 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 its is better to disable all fields and then enable only the few fields we want. Have in mind that in this case the fields contents 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 the few fields we want.



call OnOpenForm_RequiredField("fieldname")

The RequiredField specifies a field fieldname as a required one. The form does not saves to the database until the field has been filled in with data. The prompting label of the field becomes bold in order 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 required also. (the val in this case kept internally while the displayval is displayed)



call OnOpenForm_EnableField("fieldname")

If the DisableAllFields has has been used then the EnableField enables the fieldname field of the form.




call OnOpenForm_ShowField("fieldname")

If the HideAllFields has has been used then the ShowField becomes visible the fieldname field of the form.




call OnOpenForm_HideField("fieldname")

The HideField hiddes the fieldname. Its used in cases when the fieldnames value is required to kept out of users sight.

call OnOpenForm_HideControl(controlname) 

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")


                       expr = strcat(rec,"=REQUEST")

                       call OpenFormModal("ptEdit","REQUEST02.FM","WORK.REQUEST",1,expr)