My goal: validate body field for minimum number of words.

I apply the "number of words" validation rule with the following settings:

Column: value
Minimum number of words: 50
Maximum number of words: (empty)
Custom error message: Your blog post must have more than [min] words. You currently have [count].

However, this validation has no affect :-(

I've tried to produce some sort of error by:
- creating a new content type and applying the same validation on the body field
- creating a new field and applying the validation
- attempting to validate on length
- attempting other validation rules (i.e. email) on different fields.

All validations have not worked. The node saves without, by the looks of it, the validation rule ever being checked.

Am I missing a step? Is there modules that clash with this one?

Any help/advice would be greatly appreciated.

CommentFileSizeAuthor
#5 enabled_modules.txt6.33 KBtr33m4n
#2 list_of_enabled_modules.txt14.41 KBydahi

Comments

ydahi’s picture

Issue summary: View changes
ydahi’s picture

StatusFileSize
new14.41 KB

I just tested out the module simplytest.me and it's working fine. Must be something wrong with my set up.

Attached is a list of modules used on the build, if any one has come across this issue before please share your insight.

efes’s picture

I have the same issue, and till now I was unable to find any solution.
I've tested phone, number(html5) and integer validation, none of them worked.

g089h515r806’s picture

clear the Cache and test it again.

tr33m4n’s picture

StatusFileSize
new6.33 KB

Also encountering the same issue... Nothing in the logs. Quite stumped to be honest... Here's my module list for the sake of it

pawel_r’s picture

For me problem causing module is More Buttons, exactly submodule called 'More Buttons Content'.

It's on the ydahi's modules list.

kenorb’s picture

Tested Custom error message for Required field plugin, but it doesn't work. Tested for text fields and other fields for Content type and Entity forms, including On/Off 'Set errors using field API', and it's just saying

Foo field is required.

.

kenorb’s picture

Version: 7.x-2.4 » 7.x-2.x-dev
kenorb’s picture

Reproducible steps:

1. Launch sandbox at https://simplytest.me/project/field_validation/7.x-2.x
2. Log-in as admin, go to Modules (/admin/modules) and enable: 'Field validation extras' and 'Field Validation UI' modules.
3. Add new Text field into Basic page (/admin/structure/types/manage/page/fields) and set it to 'Required field' and Save.
4. Edit it again, go to Validation tab and add 'Required field' plugin and create rule with Column:value and 'Custom error message'.
5. Add new content (/node/add/page) and Save. The custom error message doesn't show, instead we see:

Title field is required.
Foo field is required.

Checking/un-checking 'Set errors using field API', Overlay doesn't make any different.

It works only when field is not set as 'Required'.

Is that a bug or expected behaviour?

Also opened core issue at: #2604898: drupal_validate_form doesn't respect hook_field_widget_error when field is Required.

kenorb’s picture

g089h515r806’s picture

Status: Active » Closed (outdated)