Mark7294305
Posts: 0
Joined: Fri Dec 26, 2014 2:10 am

checkbox and radiobox to open as unticked

Hello Support
I have an app with multiple checkboxes and radioboxes. When using the app, I will for example tick a box in the checkbox and then the checkbox closes. However if a another checkbox is opened on the same page it is automatically opened with a box already ticked. I wish for whenever a checkbox or radiobox is opened or reopened on the same page that it is opened with all boxes unticked. What is the JS code for this?

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

checkbox and radiobox to open as unticked

Can you describe this part "However if a another checkbox is opened" so that i can try to help? What exactly does opened mean here?

Mark7294305
Posts: 0
Joined: Fri Dec 26, 2014 2:10 am

checkbox and radiobox to open as unticked

ok lets say for example that I have checkbox group 1 which contains all girls names and checkbox group 2 which contains all boys names but only one checkbox group is displayed on screen at a time. what is happening is I select the third checkbox on the list on the girls name checkbox group and then close that checkbox group. If I then open the boys name checkbox group or reopen the girls name checkbox group the checkbox group opens with the third checkbox already ticked. I want the checkbox groups to open with no checkboxes ticked

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

checkbox and radiobox to open as unticked

ok that's pretty straightforward. Here's what you can do - say the checkboxgroup for boys is called chkboys and the one for girls is called chkgirls

Before showing chkgirls (Checkbox group) you can run the below code to clear all the checked / ticked checkbox items in checkboxgroup for girls

// The below code will loop through all the checked items in the checkboxgroup called "chkgirls" and uncheck them. You can use the same method with "chkboys" before displaying the boys checkboxgroup.

code
Apperyio("chkgirls").find("input:checked").each(function(){ // Loop thru girls checkboxgroup
$(this).prop('checked', false).checkboxradio("refresh"); // Uncheck them
});
/code

Alternatively you can also toggle the checkboxes using classnames. But I think the above is pretty straightforward and should work in almost all circumstances.

Return to “Issues”