cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with check box?

Former Member
0 Kudos

Hi All,

As per the requirement, I have a view and in that I have to have a check box.

In the same view I have a button. On click of that I have to display a popup with three drop downs.

So, if the check box is checked, then one of the three drop downsin the popup should be disabled. if not then when the button is clicked the the popup should come with all the drop downs enabled.

I have taken check box by key. I have assigned to the checked property of the check box UI element a boolean value.

And to the toggle action i have got an event handler also.

But I am nt able to set the drop down disabled and enabled.

So if any one of you can let ma the correct approach with code snippet the it will be relly appreciable.

Regards

DK

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

There are probably two views involved: View1 containing the check box and the button, and view2 (embedded in the popup window) containing the drop-down lists.

To be able to use data binding between different views, you can use an attribute "Checked" in the component controller (or a custom controller) to store the value of the check box.

Map both view contexts to the component context and add a calculated attribute "Enabled" to view2. Bind the "enabled" property of the mentioned drop-down list to attribute "Enabled" and bind the "checked" property of the checkbox to "Checked".

You don't need an action at the checkbox in this case. If the button is pressed and the popup window is opened, attribute "Enabled" is recalculated:

boolean getEnabled(IPrivate<View2>Element element)
{
  return !element.getChecked();
}  

Armin

Answers (2)

Answers (2)

sridhar_k2
Active Contributor
0 Kudos

Hi DK,

In your Button Action Button, get the boolean value(which is binded to the check box),based on the values (true / false), enable the dropdowns.

// you can get the check box value(Normal Check Box)

manager.reportSuccess(" Check Box Val "+wdContext.currentContextElement().getCheckboxVal());

Where you are enabling these dropdowns, in the same view or different view, if in the different view, take a controller variable and assign this check box value to the that variable.

//Get the checked value programatically and assign it to the //drop down Enabled property.

wdContext.currentContextElement().setDropDown1Enabled(true/false);

Regards,

SK

Former Member
0 Kudos

Hi

As you said you got the toggle action in that based true or false.

Whether the boolean is true make it Visible(declare a Visible attribute for the dropdown).

wdContext.currentContextElement(WDVisibility.Visible);

else

wdContext.currentContextElement(WDVisibility.BLANK);

It might helps other wise post ur issue.

Thanks

Lohil.