WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Contact Form 7] Anyone knows how to limit the textarea to 250 characters?

[Plugin: Contact Form 7] Anyone knows how to limit the textarea to 250 characters?

  • Hi everyone,

    Anyone knows how to limit the textarea to 250 characters?

    Currently, this is wat i did –

    function wpcf7BeforeSubmit(formData, jqForm, options) {
        //Modification
        var question = jQuery('textarea').val();
        var qLen = question.length;
        if (qLen > 250) {
            alert('Oops, your question is over the 250 character limit! Click OK to rephrase and submit.');
            return false;
        } 
    
        //End modification
        wpcf7ClearResponseOutput();
    
        jQuery('img.ajax-loader', jqForm[0]).css({ visibility: 'visible' });
    
        formData.push({name: '_wpcf7_is_ajax_call', value: 1});
    
        jQuery(jqForm[0]).append('<input type="hidden" name="_wpcf7_is_ajax_call" value="1" />');
    
        return true;
    
    }

    The problem now is that the client is still receiving test messages.

    The process should be like this – I type a message more than 250 characters and then a pop-up message will appear to warn me and ask me to rephrase the message. I click ok and now I can edit my message in the textarea.

    So the client now receives test messages still.

    Anyone can help or have another alternative solution to this? Much appreciated. =)

  • The topic ‘[Plugin: Contact Form 7] Anyone knows how to limit the textarea to 250 characters?’ is closed to new replies.