PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Limiting checkbox multiselect AND hidden field reveal

  1. spatil
    Member

    We've been able to limit multiselect checkboxes to two (out of six). But we have hidden fields that reveal when a box is checked and after checking two boxes, a third hidden field is revealed if the user happens to check a third box. We are trying to limit the hidden field reveals to only the boxes checked.

    Here's the code. Any help would be much appreciated!

    [js]
    jQuery('ul#input_3_23 li input').click(function(){
    
    		if(jQuery(this).is(':checked')){
    			var curavaildata = jQuery(this).val();
    			hiddenvalue = hiddenvalue + curavaildata + ";";
    		}
    		else{
    			var curavaildata = jQuery(this).val();
    			curavaildata = curavaildata + ";";
    			hiddenvalue = hiddenvalue.replace(curavaildata,"");
    		}
    		jQuery('input#input_3_41').attr("value",hiddenvalue);
    		//Fill in the hidden field for the availability data
    
    //check-box limit
     $.fn.limit = function(n) {
     var self = this;
    this.click(function(){ return (self.filter(":checked").length<=n); });
    }
    $("ul#input_3_23 li input:checkbox").limit(2); 
    
    	});
    Posted 12 years ago on Tuesday December 27, 2011 | Permalink
  2. I am forwarding this post to one of our developers who will review it and let you know if he has any suggestions.

    Keep in mind this is a customization and technically customizations are not part of support... we'll do our best to provide you with guidance but ultimately we can't write customizations or custom code so we'll have to see if it's something that can be resolved simply via high level guidance or a quick example.

    The developer I have assigned it to is out today due to the holidays but should be able to respond to this when he is back in the office tomorrow.

    Posted 12 years ago on Wednesday December 28, 2011 | Permalink
  3. Hi Spatil,

    I'm not 100% sure I follow what you are trying to accomplish. Could you post a live sample of your current form and perhaps some additional clarification on your end goal? :)

    Posted 12 years ago on Thursday December 29, 2011 | Permalink

This topic has been resolved and has been closed to new replies.