Tuesday, August 31, 2010

Making buttons/Controls invisible

Sometimes greatest treasures are those which are invisible to eyes. Hiding controls at runtime could be fun and at times very useful.This may help in avoiding creation of multiple applets. Recently i came across a scenario where in one view user was allowed to perform some operation on button click while in other views he should not see buttons. One approach is to have applet Base mode defined in the other view w/o buttons but it fails when mulitple toggles are defined in the applet and applet defined in view is of mode type "Edit". Other option is to make controls invisible. Following code could be useful for making buttons hidden in Form Applet dynamically based on the View type. Again Browser Script is our friend.

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

Siebel give capabilities that our own Mr India will be proud of!!!

No comments: