At the moment when a user gets an error message, it says "The "name of" field requires a unique value, and the specified value is already used."
Could you add add a link to the actual node so the text could read:
The {field} requires a unique value, and the specified value is already used {here} <-link to node
Or even a better way could be just to forward them to the actual node itself. This prevents users from ever seeing an error message.
Thanks
Comments
Comment #1
Fayna commentedI think the best way to handle this is to redirect the user to the already existing node.
Comment #2
crea commentedIf anyone wants to commit the patch, here is sample code I made for this feature
Find the line
and replace with the following:
Then find the line
form_set_error($field, t($errmsg, array('@label' => $labels[$field], '@labels' => join(', ', $labels))));and change to
form_set_error($field, t($errmsg, array('@label' => $labels[$field], '@labels' => join(', ', $labels), '!matches' => $matches[$field] )));This code will output found matches for single 'Each of the specified fields must have a unique value.' mode, but this can be easily adapted to work in all modes.
Full solution would be to expand this into unique-field setting like option "Show matching nodes", and show node titles as anchors, but this simple code was enough for my need
Comment #3
summit commentedSubscribing, please file a patch for this finding!
I also get this error when somebody wants to change older content, how is this possible please?
Thanks a lot in advance!
Greetings, Martijn
Comment #4
arithmetric commentedHi all,
I've added this feature to the module as of the beta 1 version. In the unique field configuration settings on a content type form, you will find a checkbox to enable showing which nodes were found with matching values. Only nodes that the user is authorized to view will be displayed.