Hiding and Showing Fields in Browser vs Mobile

How Can We Help?

Hiding and Showing Fields in Browser vs Mobile

< Back

Problem

Sometimes, we want to show some controls only in mobile and hide in desktop or vice versa.

Solution

Write the below logic on the activity load to determine if the form is being opened in the mobile app or browser, and logic to hide or show the controls accordingly.

Sample code

public void AP30Process_OnLoad()
{
     ObjectGroup grp = activity.ObjectGroups["0"];
     if (System.Web.HttpContext.Current == null ||
     System.WebHttpContext.Current.Session == null)
     {
          //Mobile
          grp["AP30250QuickLinks"].Options["Visible"] = "False";
     }
     
     else
   
     {
          //Desktop
          grp[AP30250QuickLinks"].Options["Visible"] = "True";
     }
}

In the above example logic, it checks using an if condition if the form is opened in browser or in a mobile app. It is also performing the  logic to hide / show fields accordingly.

 

Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X