• Resolved kstyuen

    (@kstyuen)


    Hi,

    I want to make use of the check boxes but I want to know how I can set a limit to the number of check boxes I can tick based on a checkdown boxes’ values.

    Additionally, I also want to set the value of the MAX for a series of number fields based on the already inputed numbers in the series. For example, lets say I have 4 numbers fields in my series – the MAX value at first would be 6, and so if I input a value 5 in the first field the MAX value of the other fields would become 1.

    Thanks

    Kevin

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello Kevin,

    The behaviors you’r requesting is very specific to your project, so, you will need some additional code.

    Assuming that the maximum number for all input fields is the number 6:

    – Insert a “HTML Content” field in the form with a piece of code similar to the following one as its content:

    <script>
    var supermax = 6;
    jQuery(document).on('change', 'input[max]', function () {
    	var v = 0, minMax;
    	jQuery('input[max]').each(function () {
    		v += this.value * 1;
    	});
    	minMax = max(supermax - v, 0);
    	jQuery('input[max]').each(function(){if(this.value=="")jQuery(this).attr('max',minMax);});
    });
    </script>

    For the checkboxes field would be required some additional code too, in this case assuming that the checkboxes fields is the fieldname1, and the maximum number of choices to be checked is 3, the piece of code would be:

    <script>
    var maxcheckboxes = 3;
    jQuery(document).on('change','[id*="fieldname1_"]', function(){
    jQuery('[id*="fieldname1_"]').prop('disabled', false);
    if(maxcheckboxes <= jQuery('[id*="fieldname1_"]:checked').length )
    jQuery('[id*="fieldname1_"]:not(:checked)').prop('disabled', true);
    });
    </script>

    I’m sorry, but if you need additional help with features that are not part of the plugin, you should request a custom coding service throught our private website:

    http://cff.dwbooster.com/customization

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Set Check Box Limit and Max value limit based on calculated Field’ is closed to new replies.