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.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | enabled_modules.txt | 6.33 KB | tr33m4n |
| #2 | list_of_enabled_modules.txt | 14.41 KB | ydahi |
Comments
Comment #1
ydahiComment #2
ydahiI 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.
Comment #3
efes commentedI 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.
Comment #4
g089h515r806 commentedclear the Cache and test it again.
Comment #5
tr33m4n commentedAlso encountering the same issue... Nothing in the logs. Quite stumped to be honest... Here's my module list for the sake of it
Comment #6
pawel_r commentedFor me problem causing module is More Buttons, exactly submodule called 'More Buttons Content'.
It's on the ydahi's modules list.
Comment #7
kenorb commentedTested 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
.
Comment #8
kenorb commentedComment #9
kenorb commentedReproducible 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:
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.
Comment #10
kenorb commentedI believe this could be related: #549020: form_set_error should accept multiple errors on one component
Comment #11
g089h515r806 commented