cancel
Showing results for 
Search instead for 
Did you mean: 

How to Disable CheckBox for a Particular Condition

Former Member
0 Kudos

Hi All,

In my application, iam using one table having 5rows , with checkboxes,

based on one condition i want to make few checkboxes as default disable in the same table, and some checkboxes i shud make it as enable, so experts please help me how to disable some checkboxes.

disable means even if we select it shud not get selected, like that is it possible,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

create one context attribute of type boolean.and bind it with enabled property of chekbox.

And write code as follow.



for(int j=0;j<=wdContext.nodeA().size();j++)
    {
    
    if(<your condtion on which you will ne set the checkbox disable>)
{

wdContext.currentContextElement().set<created contex of tyape boolean>(False);
 }
}

Edited by: Abhilasha Dahare on Apr 27, 2009 8:05 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Add an attribute of type boolean to the Node for which table is to be created.

For each Table element, set its value to be True/False depending upon your requirement.

Bind this attribute to the "Enabled" property of checkbox.

Regards

Shruti

Former Member
0 Kudos

HI

create a context attribute and make its data type as boolean .

bind this context attribute property to check box property enabled or readonly .

then in the if () condition , you can make set the context attribute value true or false with

your requirement .

Former Member
0 Kudos

Hi Sushma,

You can have one more attribute in the same node from where you are populating the table and bind this boolean attribute to the enabled property of your CheckBox.

and by looping thriugh the table you can check for conditions and based on it set the Enability of the checkbox.

for (int iRowsCount =0;iRowsCount < wdContext.node<name>().size();iRowsCount++)
{
if (condition)
{
// Disabling the Checkbox based on the condition
wdContext.node<name>().get<name>ElementAt(iRowsCount).set<BooleanAttributeName>(false);
}

}

Hope this helps!!

Cheers,

Arafat