Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When the textfield does not validate, the field is not assigned the "error" class and is not highlighted.
I am using version 7.x-1.0+8-dev on drupal 7
I solved the issue by adding a line of code but I don't know if there is a better way
Added to line 222:
// Add "error" class to non-valid field.
$form_state["complete form"]["field_location"]["und"][0]["select_other_text_input"]['#attributes']['class'][0] .= " error";
}
Comment | File | Size | Author |
---|---|---|---|
#2 | 1650674-error-class-on-text-input-3.patch | 1.34 KB | mradcliffe |
Comments
Comment #1
mradcliffeYes, for some reason it's not adding the class when form_set_error or form_error is called. This is usually automatic, but it's probably getting confused by the array parents.
Comment #2
mradcliffeHere's a patch (combined, i have two commits ready). Let's see how badly it fails on PIFR (Can't run tests locally because MAMP/Simpletest seems to be borked).
Comment #3
mradcliffeWelp. Even pifr can't run tests (branch fails on something that passes everywhere else).
This works for me. Passes all tests on another box just fine. Just need to add an assertion for the class in the validation test.
Comment #4
mradcliffeOkay, test added, and all tests pass.
Comment #5.0
(not verified) CreditAttribution: commentedupdated formatting