I want to set "minimum characters" validation for text box in Forminator

I want to set “minimum characters” validation for text box in Forminator like there is a validation for “Max characters”.

  • Nithin
    • Support Wizard

    Hi Alex,

    At the moment, I’m afraid, I don’t see any filters that could be used as a workaround to add validations for minimum characters check in TextArea.

    I’m bringing this into our plugin developers attention, so that they could look into the possibility of implementing such a feature in the plugin side in future release. Could I also know for what exact use case you are looking for a Minimum Characters validation in your website? So, that it would give our developers a better idea on how well this could be executed in the plugin side for future.

    Will keep you posted once I get further feedback regarding this . Thanks for suggesting the feature request.



  • Nithin
    • Support Wizard

    Hi Alex,

    I checked with our SLS team, and got a custom workaround for this. However, the validation message error, can only be shown once the form is submitted.

    You can try the following code inside a mu-plugins:


    add_filter( 'forminator_custom_form_submit_errors', function( $submit_errors, $form_id, $field_data_array ){

    $field_id = 'textarea-1';

    foreach ( $field_data_array as $key => $field ) {

    if ( $field_id === $field['name'] ) {

    if ( 15 > strlen( $field['value'] ) ) {
    $submit_errors[] ='textarea-1';
    $_POST['forminator-textarea-invalid-length'] = true;



    return $submit_errors;
    }, 20, 3 );

    add_filter( 'forminator_custom_form_invalid_form_message', function( $invalid_form_message, $form_id ){

    if ( isset( $_POST['forminator-textarea-invalid-length'] ) && $_POST['forminator-textarea-invalid-length'] ) {
    $invalid_form_message = 'You need to insert at least 15 characters in the textarea';

    return $invalid_form_message;

    }, 20 ,3 );

    In the above code, the variables:

    <strong>$field_id = 'textarea-1';

    textarea-1” should be changed to the Texarea ID of your form, the value is visible when you edit the form, as seen in the following screenshot:

    The following line:

    if ( 15 > strlen( $field['value'] ) ) {

    The number 15 is what’s set as the “Minimum Characters”, you can change the value to your needs. You can implement the code as a mu-plugins, please check this manual on how to implement as a mu-plugins:


    I hope this helps. If you aren’t sure on how to add the code, please do share your sites login credentials, so that we could help with adding the above code in your site.

    You can send credentials by using our secure contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    – To Mark to my attention, the subject line should contain only: ATTN: Nithin Ramdas

    -WordPress admin username

    -WordPress admin password

    -login url

    -FTP credentials (host/username/password)

    -link back to this thread for reference

    -any other relevant urls

    Please do follow up in the ticket once you have sent the above credentials. Have a nice day. :slight_smile:

    Kind Regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.