I'm using editable views in a views form for a non-core entity (entityform).
In my case I have multiple number fields per row I want to be able to edit using this.
(Imagine like you want to give a "rating" to the entityform in various areas)
So.. after some usage I noticed that if a field has a validation error (in my case if its outside min/max allowed values), the only field that will become "red" (will have an error) will be the first field of the row, even if that field is correct.
After some digging in module's code I noticed that in editableviews_entity_form_validate, for each row, each field checks if each other field has any error. That caused the first field to trigger like it was the one that had the error, and not any other.
I also noticed this comment in the code:
// This is ugly, but only FieldAPI field handlers need this. The
// alternative would be for the editableviews_handler_field_field_edit
// handler's edit_form_validate() method to detect whether it's the
// last FieldAPI field handler for the current entity, which would be
// messier.
Comment | File | Size | Author |
---|---|---|---|
#7 | editableviews-validate-proper-fields-2797827-7.patch | 1.74 KB | Zekvyrin |
|
Comments
Comment #2
Zekvyrin CreditAttribution: Zekvyrin commentedTo fix that I implemented something different than what mentioned.. I added a check and that sends in the field handler only the errors assosiated with the field (for each field).
Comment #4
Zekvyrin CreditAttribution: Zekvyrin commentedUploaded wrong patch.. :/
re-uploading..
Comment #5
Zekvyrin CreditAttribution: Zekvyrin commentedComment #6
joachim CreditAttribution: joachim as a volunteer commentedThanks for the patch!
So is this fixing your original problem?
> So.. after some usage I noticed that if a field has a validation error (in my case if its outside min/max allowed values), the only field that will become "red" (will have an error) will be the first field of the row, even if that field is correct.
The 'This is ugly...' comment block needs to be moved so it sits above the 'if (method_exists' line, as that's what it's referring to.
Comment #7
Zekvyrin CreditAttribution: Zekvyrin commented@joachim: Yes, that fixes the issue.
Moved the comment with new patch.
Comment #9
joachim CreditAttribution: joachim as a volunteer commentedOk. Committed.
Thanks!