Problem/Motivation

The field validation error message only says the value for a particular field is not a valid URL. Because fields can have multiple values (50 in our current project), it can be hard to find the exact URL that is incorrect.

Proposed resolution

Include the incorrect value in the error message.

Remaining tasks

None.

User interface changes

A slight change in a translatable string.

API changes

None.

CommentFileSizeAuthor
#4 link_2351223_3.patch762 bytesXano
#3 link_2351223_3.patch0 bytesXano
#3 interdiff.txt761 bytesXano
#1 link_2351223_1.patch762 bytesXano
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Xano’s picture

Status: Active » Needs review
FileSize
762 bytes
marcvangend’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/link.module
@@ -396,7 +396,10 @@ function _link_validate(&$item, $delta, $field, $entity, $instance, $langcode, &
+          '@value' => trim($item['url']),

Nitpick: I would use %value here. Otherwise RTBC.

Xano’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
761 bytes
0 bytes
Xano’s picture

FileSize
762 bytes
marcvangend’s picture

Status: Needs review » Reviewed & tested by the community

Totally makes sense.

jcfiala’s picture

Status: Reviewed & tested by the community » Fixed

Well, the patch required changes to my automated tests to pass, but given the few folks who have learned how to update tests (and given how useful I think this might be) I went in and edited the tests to match.

Applied patch and committed to 7.x-1.x.

  • jcfiala committed cfc3e7d on 7.x-1.x authored by Xano
    Issue #2351223 by Xano: Improve field validation error message.
    
Xano’s picture

Thanks! Which tests do you have that are not run by the testbot?

marcvangend’s picture

Thanks John.

Sorry I failed to notice the module has automated tests, I wouldn't have RTBC'd it if I knew. Do you know why the test bot did not automatically test these patches?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.