cancel
Showing results for 
Search instead for 
Did you mean: 

How to use checkboxes and button together

Former Member
0 Kudos

My requirement is that i am having option of checkboxes and depending upon the checkbox user selects and then click on button , then table should come according to the option user has selected in checkbox. So how the button should communicate that which checkbox has been selected and based on that checkbox table should come. For checkboxes i hve taken checkboxgroup .

Accepted Solutions (1)

Accepted Solutions (1)

former_member218672
Active Contributor
0 Kudos

Hi Saurabh,

Take boolean context parameter's corresponding to your checkbox's and on the onclick method of checkbox set that property value to true or false.

So, you can read this boolean context from your button onclick as per your requirement.

Regards,

Sen

Former Member
0 Kudos

Hi

Please explain it more elaborately with codes.

Thanks

former_member185879
Active Contributor
0 Kudos

Hello Saurabh,

As i understand, i hope you will select only one check box and more than one, as you said, you are going to display separate table for all the check boxes. if this is the case, then i will suggest you to use RadioButtonGroupByKey.

You will get the key you selected in the RadioButton and according to that you can display the table.

Revert for any queries.

Regards

Nizamudeen SM

Former Member
0 Kudos

Hi,

Every check box has mandatory property checked of boolean type. This keeps the value of checkbox (true if selected false if not selected).

So bind the check box with context value attribute and in button action check the values of those context value attributes. You can find out the check boxes which were selected.

If there is a scenario that only one checkbox need to be selected then go for radio button ui element.

Regards

Deepak

Former Member
0 Kudos

Hi,

I have to use checkboxes only. Here i have changed from Checkboxgroup to checkbox only. I have to select multiple checkboxes and based on that table should come . You have thought right that on selection of checkboxes and clicking of button i want result, How to do this? Please explain elaborately with codes.

Thanks

former_member185879
Active Contributor
0 Kudos

Hello Saurabh,

Place the checkboxes and bind boolean attributes to those checkboxes.

Before doing this, create a attribute of type visibility and bind it to the table and make that none as below.

wdContext.currentSampleElement().setTableVisibility(WDVisibility.NONE);

in Button Action write the following.

//getcheck1 is the attribute of type boolean.

if(wdContext.currentSampleElement().getcheck1())

{

//Display the table.

wdContext.currentSampleElement().setTableVisibility(WDVisibility.VISIBLE);

}

Same way you can to for other check box also.

Regards

Nizamudeen SM

Former Member
0 Kudos

Hi ,

thanks for solving the problem. I am now closing this question . And posting a new thread .In that everything is same and the thing added is that : infront of each checkbox is a input field where user will enter the amount of tables he want and after clicking the button that number of tables should come . Please anwer to that thread also.

Thanks

Saurabh

Answers (1)

Answers (1)

Former Member
0 Kudos

Are you sure that you need a checkbox group and not a radio-button group in your scenario?

"Communication" is done via context data. In the action handler you can check the context data that represent the selection and act accordingly.