Check the Comment in Reply or Normal State

I’m currently working with custom comment meta, and I have some custom additional field such as rating etc, when user write a comment ( not comment reply ) I want to show the rating field, but when it’s on reply comment state I want to remove this field.

Is there a build in conditional function to check whether it’s in a reply state or not? or any other way to achieve what I want?

Related posts

Leave a Reply

2 comments

  1. I realize this question is quite old, but I just solved this problem today with a JQuery-based approach.

    jQuery( function() {
      jQuery("#commentform").attr("data-parsly-validate", " ");
    
      jQuery("#commentform").parsley();
    
      jQuery(".comment-meta-header .comment-reply-link").click(function(){
        jQuery("#commentform .comment-form-area, #commentform .comment-form-type").hide();
        jQuery("#starling-comment-area, #starling-comment-type").removeAttr("required");
      });
    
      jQuery("#cancel-comment-reply-link").click(function(){
        jQuery("#commentform .comment-form-area, #commentform .comment-form-type").show();
        jQuery("#starling-comment-area, #starling-comment-type").attr("required", " ");
      });
    });
    

    Basically I have click handlers for when the “Reply” or “Cancel” links are clicked, and I handle form validation with Javascript (using Parsley, in this case).

    For server-side validation you can use diggy’s solution.