Appnitro Software Forums » MachForm

Select All Feature for Checkboxes

(5 posts)

  1. Is there a way to have an option in the Checkbox list to "select all" - and all options are checked automatically?

    Thanks!

    Posted 2 years ago #
  2. I think it can be done by adding a javascript to your "includes/view-functions.php" file. To do so, you need add 1 check box option to trigger "select all" function.
    Let say your "check box" id's is 1 and your "select all" option id's is "element_1_4", then edit "includes/view-functions.php" file and go to around line 1832 for this code :

    <script type="text/javascript" src="js/view.js"></script>

    put these code exactly bellow that line

    <script type="text/javascript" src="js/jquery/jquery-core.js"></script>
    <script type="text/javascript">
    	var flag = 0 ;
    	$(document).ready(function() {
    		$('#form_6 #element_1_4').click(function() {
    			if (flag == 0) {
    				$('#li_1 :checkbox').attr('checked',true);
    				flag = 1;
    			} else {
    				$('#li_1 :checkbox').attr('checked',false);
    				flag = 0;
    			}
    		});
    	});
    </script>

    After that you need to adjust those id's to get the script working properly in your form.

    Posted 2 years ago #
  3. This worked great. However, the option id was hard to identify. Is there an easy way to know what number it is? For example, it was not the 4th option (because I had deleted options and added others).

    Posted 2 years ago #
  4. You can see form HTML source code to see the option id, but if you're using Firefox maybe you can try to use "Firebug" add-ons from there.

    Posted 2 years ago #
  5. Can I modify this by having a checkbox such as "select all morning sessions" and it will check certain element checkboxes only (and not all)?

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.