Would it be possible to create a custom error message for each content type? If you can use tokens that would be even better.

Comments

Platinum’s picture

Category: support » feature
ChaosD’s picture

subscribed

would it also be possible to summarize the messages or completely customize it with tokens? i.e. if i have 3 fields to be checked for uniqueness and 2 are duplicates it says :

Hint: A similar post has already been created at nodetitle[link]
Click here[link-bypass] to post anyways

instead of:

# The From field requires a unique value, and the specified value is already used. Matches are found in the following content:

    * title

Click here to bypass this check and resubmit.
# The field requires a unique value, and the specified value is already used. Matches are found in the following content:

    * field

Click here to bypass this check and resubmit.
giorgio79’s picture

+1

tiw’s picture

Any solution to create customized error messages?

Thanks,

pbeakley’s picture

Subscribing! Although for now I think I'm going to need to use Rules to make this happen.

GroovyFX-Matts’s picture

Subscribing

giorgio79’s picture

This could be taken care of by integrating with Rules #859714: Rules Integration

benmalen’s picture

Subscribing. This is exactly what I was going to request, but for 7.x

DickSwart’s picture

Subscribing - Any solution to create customized error messages?

Thanks

adamgerthel’s picture

+1 for this. I need it for D6

wjaspers’s picture

Version: 6.x-1.2 » 7.x-1.x-dev
Issue tags: +needs backport to 6.x

Working on a 7.x patch at this moment. Will backport once finished.

wjaspers’s picture

Status: Active » Needs review
StatusFileSize
new2.41 KB

This introduces error handling on a per-content-type basis. The message of choice if the scope is across "ALL" content will be the error message that exists for the content (type) currently being edited. More work needed to make it use the custom message for different scopes.

dreftymac’s picture

Title: Custom error message for each content type » Workaround: Custom error message for each content type

PROBLEM:
CCK unique_field module does not support configurable actions when a field duplication rule is violated.
The only action available is the display of a standard error message.
The error message is always the same regardless of the duplication context or node type.

WORKAROUND-001:
Use the stringoverrides module to change the default error message.
(See http://drupal.org/project/stringoverrides)

### ********************
### original
The @label field requires a unique value, and the specified value is already used.

### ********************
### replacement
The @label specified already exists in the database, Please click here for more details.

BENEFITS-001:
Using this method, it is possible to get (minimal) Rules integration.
Rules integration can be done by triggering a rule whenever the user clicks on the link in the custom error message.
Just make a custom rule to do whatever action you want.
(See http://drupal.org/project/pathrules)

PITFALLS-001:
This only provides a way to change from one singular fixed error message to another.
This still does not provide custom error messages for each duplication context.
This does not provide robust legitimate Rules integration.

wjaspers’s picture

Title: Workaround: Custom error message for each content type » Custom error message for each content type

String overrides are most often intended for internationalization and localization purposes. As easy as it would be to use them, I don't think its very practical, and adds maintenance for site owners.

My patch didn't introduce any rules integration, so I have no idea where you're getting that part from.

jordanmagnuson’s picture

Status: Needs review » Reviewed & tested by the community

Been using #12 patch on a production site, and it seems to work well. Any chance of getting this committed?

giorgio79’s picture

delacosta456’s picture

Issue summary: View changes

@giorgio79 most of people have tried field_validation with the "Unique value on multiple field" option and it doesn't work most of the time. That is we we refer to this module

astonvictor’s picture

Status: Reviewed & tested by the community » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks