Multiple text areas with word count

Home Forums Quform WordPress Multiple text areas with word count

This topic is: resolved
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #36211
    metaphase
    Participant

    Looking for some help to adjust the code found on this link, to allow multiple text areas in the same form to all have word count validation (and preventing the user typing over that limit in the field).

    Word counter

    Thanks a lot

    #36212
    metaphase
    Participant

    (and not all the same word limits)

    #36218
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #36228
    metaphase
    Participant

    Thanks, although I cant get this working. I am guessing I also need to do something thats in my other code snippet, currently:

    add_filter(‘quform_element_valid_1_5’, function ($valid, $value, Quform_Element_Field $element) {
    $max = 300;
    $count = preg_match_all(‘/\S+/’, $value);

    if ($count > $max) {
    $element->addError(“Please enter no more than $max words”);
    $valid = false;
    }

    return $valid;
    }, 10, 3);

    #36230
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #36231
    metaphase
    Participant

    Sorry was my mistake, cos I added more fields than the 2 you gave I didnt add commas after the new ones.

    All seems to work perfectly thanks.

    #36232
    metaphase
    Participant

    Unrelated quick question though, is why do dropdown fields appear bold, including their label. They stick out from other fields, is that by design?

    Thanks

    #36234
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy