rules not work in jQuery validate function : I don't know what's wrong with my code as i am newbie to jQuery validate function,
i want to use `'required'` value `'true'` or `'false'` dynamically for add and edit page separately. i want field `'cate_image'` set to 'not required' in edit page as already have an image which inserted in 'add' page but need to validate only image format using '`accept`'. help me out.

    if($("#hidden_cate_id").val() > 0){
      var tf = "false";
    }else{
      var tf = "true";
    }
         
    $("#form-addcategory").validate(
      {
        rules: {
          cate_name: { required: true },
          cate_image: { required: tf, accept: "image/jpg,image/jpeg,image/png" }
        },
        messages: {
          cate_name: { required: "Category name is required" },
          cate_image: { required: "Category image is required" }
        },
      });

i put `if` condition for edit page if `$("#hidden_cate_id").` exist `tf` value will `false` and only check for `accept` rule. but it doesn't works !