Home › Forums › Quform WordPress › Multiple text areas with word count
- This topic has 7 replies, 2 voices, and was last updated 1 year ago by Ally.
- AuthorPosts
- November 14, 2023 at 9:09 pm #36211metaphaseParticipant
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).
Thanks a lot
November 14, 2023 at 9:11 pm #36212metaphaseParticipant(and not all the same word limits)
November 15, 2023 at 10:36 am #36218AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 16, 2023 at 9:55 am #36228metaphaseParticipantThanks, 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);November 16, 2023 at 10:20 am #36230AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
November 16, 2023 at 10:29 am #36231metaphaseParticipantSorry 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.
November 16, 2023 at 10:31 am #36232metaphaseParticipantUnrelated quick question though, is why do dropdown fields appear bold, including their label. They stick out from other fields, is that by design?
Thanks
November 16, 2023 at 10:53 am #36234AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.