HowTo: Using ControlValueChanged event

Official Content
This documentation is valid for:

For this tutorial we are going to use LightCRM (X Evolution 2) sample to exercise the use of Control Value Change Event.

The objective is that the insertion of the data of a Contact in this app should be done progressively, only when you completed the previous data the next inputs are going to appear.

Step1: Prepare the Screen

On the object WorkWithDevicesContact Section General Edit layout we are going to set the property visible to false for the following controls.

Table2, Table3, ContactEmail, CompanyName.

After adding the ContactName automatically the ContactEmail will appear and after completing the ContactEmail the CompanyName attribute will appear.

Step2: Add the behavior

Program the following events:

Event ContactName.ControlValueChanged
    Composite
        &isEmpty = IsEmpty(ContactName)
        if &isEmpty
           Msg("You have to complete the Contact Name to continue")
        else
           Table2.Visible = 1
           ContactEmail.Visible = 1
        endif
    EndComposite
EndEvent
Event ContactEmail.ControlValueChanged
    Composite
        &isEmpty = IsEmpty(ContactEmail)
        if &isEmpty
           Msg("A Complete email is required to continue")
        else
           Table3.Visible = 1
           CompanyName.Visible = 1
        endif
    EndComposite
EndEvent

The IsEmpty Procedure has the following source:

if &varChar.IsEmpty()
   &bollIsEmpty = true
else
   &bollIsEmpty = false
endif

And rules:

parm(in: &varChar, out: &bollIsEmpty);

End

Done! The example can be accessed from LightCRM (X Evolution 2).

The user is forced to enter a Name and Email to be able to complete all the form of the Contact. This is one of the many scenarios in which the Control Value Changed Event can be used.





Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.