Wednesday, May 30, 2012

Making Buttons/Controls Invisible




Scenario:
 An Applet is being used in many views and the button/control on the applet should be visible in one view only. We need to avoid creation of multiple applets. In simple words in one view user should be allowed to perform some operation on button click while in other views he/she should not see buttons.


Solution:



·         One approach is to have applet Base mode defined in the other view without buttons but it fails when multiple toggles are defined in the applet and applet defined in view is of mode type "Edit".


·         Other option is to make controls invisible. Following Browser Script code could be useful for making buttons hidden in Form Applet dynamically based on the View type.


function Applet_Load()
{
 var sView = theApplication().GetProfileAttr("ActiveViewName");
 switch(sView)
 {
  case "Related Activity View":
     var ctrlSubmit = this.FindActiveXControl("Submit"); // This is the name of control
     ctrlBack.style.visibility = "hidden";//Setting visibility property to hidden
     break;
   
 }
}



 t dynamically based on the View type

No comments:

Post a Comment