• Resolved gelion-pipi

    (@gelion42)


    Hello,

    I want to set up minimum and maximum character limits for review comments to prevent spam comments. How can I do that?

    Or if you don’t have the feature, cloud you provide me a snippet code?

    Many Thanks,

    Gemi

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Sabbir Mahmud

    (@sadhinsabbir)

    Hi @gelion42 ,

    I hope you’re doing fine.

    There is no such option in ReviewX to limit the character of a review comment.
    However, we can provide you with a snippet code, so we need some more information to proceed.

    Would you please contact our?support?
    Our dedicated support team will take care of it.

    Have a nice day. ??

    Thanks & regards.

    Thread Starter gelion-pipi

    (@gelion42)

    Hello,

    Thanks for your reply.

    Yes, Could you provide me the code here?

    Plugin Contributor Sabbir Mahmud

    (@sadhinsabbir)

    Hi @gelion42 ,

    Would you please tell me what the minimum and maximum character limits would be?

    Best regards???

    Plugin Contributor Sabbir Mahmud

    (@sadhinsabbir)

    Hi @gelion42 ,

    Please use the following JS code snippet, which will limit the comment length to 10 characters by default. If you want, you can change the character count as needed.

    const textarea = document.getElementById('comment');
    
    const maxWordsLimit = 10; // Change this to your desired word limit
    
    // Function to update word count and control input
    function updateWordCountAndControlInput() {
      const words = textarea.value.trim().split(/\s+/); // Split by whitespace
      const wordCount = words.length === 1 && words[0] === '' ? 0 : words.length;
      if (wordCount >= maxWordsLimit) {
    	textarea.value = words.slice(0, maxWordsLimit).join(' ');
    	textarea.removeEventListener('input', updateWordCountAndControlInput);
    	textarea.disabled = true;
      }
    }
    
    // Add input event listener to the textarea
    textarea.addEventListener('input', updateWordCountAndControlInput);
    
    // Initial setup
    maxWordsDisplay.textContent = maxWordsLimit;

    Feel free to let me know if you need any further assistance.

    Have a nice day.???

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Review comment length’ is closed to new replies.