/*********************** js code for api setting form page ******************************/
jQuery(document).ready(function(){
    
/****************** Validate form ******************/    
    jQuery("#reputation_management_form").validate({
            rules:{
                key:
                {
                    required:true,
                    minlength:32,
                    maxlength:32
                },
                scroll_limit:
                {
                    required:true,
                    digits:true,
                    maxlength:2
                },
                reviews:
                {
                    required:true,
                    digits:true,
                    maxlength:2
                }
            },
            messages:{
                key: {
                    required:"API key required",
                    minlength: "Please enter valid API",
                    maxlength: "Please enter valid API"
                },
                scroll_limit: {
                    required:"Please enter widget scroll limit",
                    digits:"Please enter numbers only",
                    maxlength:"Please enter valid limit length"
                },
                reviews: {
                    required:"Please enter number of reviews per page limit",
                    digits:"Please enter numbers only",
                    maxlength:"Please enter valid limit length"
                }  
            }
        });
       
       jQuery("#reputation_management_form").submit(function(){
            var valid = false;
            jQuery(".show_review:checked").each(function(){
                valid = true;
            });
            if (!valid) {
                jQuery("#show_review_error").text('Please check atleast one of show review');
            }else {
                 jQuery("#show_review_error").text('');
            }
            return valid;
        });
    
});