• Resolved oscarm2

    (@oscarm2)


    Hello.

    I have seen that in the settings of the textarea field you can put a maximum of words. My question is, can you put a minimum of words?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @oscarm2

    I hope you’re well today!

    Forminator currently provides only the “max” limit (in characters or words) but it would be doable to set a “minimum” limit in words with a bit of custom code.

    You can find such code here

    https://gist.github.com/adczk/a00fb9581668110fdb82644c0176f180

    and you can add it to your site as MU plugin:

    – create a file with a .php extension (e.g. “forminator-minium-text-words.php”)
    – copy and paste code into it
    – configure it by setting relevant values in this code block (as explained in comments in code)

    $form_ids = array( 2245 ); // IDs of forms to check; if more than one, separate by comma 
    $text_field = 'textarea-1'; // textarea field ID
    $text_words = 10; // minimum number of words to allow
    $error_msg = 'Text too short!'; // error message

    – save the file and upload it to the “/wp-content/mu-plugins” folder of your WordPress installation

    Best regards,
    Adam

    Thread Starter oscarm2

    (@oscarm2)

    Thank you! I’ve tried it and it works perfectly!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Textarea with a minimum of words?’ is closed to new replies.