Sunday, Oct. 26, 2014

Inactivate / Activate controls dynamically on button click

Written By:

|

November 22, 2012

|

Posted In:

Requirement:

The requirement is to inactivate / activate controls dynamically on a button click or through another control. In this example, we are going to control the behavior of two buttons via  third button. To bring more clarity let us assume we have 3 buttons as shown in screenshot below:

control-behaviour1

There is a functionality behind each button- Button A, Button B and Button C. Requirement is that if the user clicks on Button A, then functionality behind Button A should be invoked and at the same time, Button B and Button C should be disabled.
Similarly, if user presses Button B then Button A and Button C should be disabled.
If User presses Button C then Button A and Button B should be disabled.

Solution:

Follow the below steps to implement this requirement using Scripting at the applet level.
1. In Siebel Tools, query the applet called “Activity List Applet with Navigation” create 3 buttons as below:

control-behaviour2

Expose these buttons on the UI.
2. In the applet go to Edit Server Scripts and declare 3 global variables as shown below

 control-behaviour3

3. In the applet go to Edit Server Scripts and write the below lines of code in the WebApplet_PreCanInvokeMethod as shown below:

control-behaviour4

Notes:
RefreshRecord – without this method, an explicit refresh would be required to see which buttons got disabled at a point of time.
3. In the applet go to Edit Server Scripts and write the below lines of code in the WebApplet_PreInvokeMethod as shown below:

control-behaviour5

4. Compile the applet called “Activity List Applet with Navigation” and launch the client to find the changes as below
* As soon as Button A is pressed, Button B and Button C gets disabled

control-behaviour6

** As soon as Button B  is pressed, Button A and Button C gets disabled:

control-behaviour7

*** As soon as Button C  is pressed, Button A and Button B gets disabled:

control-behaviour8



Share This Article

About Author

Gurdeep