By pragnatek on
Hi,
I have a race_results content type which has fields including:
race - a node reference
member - a user reference
You can see this at: http://vcac.zoyen.com/node/add/race-result
I only want users to be able to create 1 race_result per user per race. Therefore I need to either:
i) dynamically filter the select list of members depending on the selection on the select list for Race
ii) make no change to add/race-result form but when a duplicate race/user is submitted I don't want to save it as a node but present the user with an error message.
Any thoughts on how to achieve this? Or any other options I've not thought of?
Thanks
Comments
There is unique_field module,
There is unique_field module, but if I understand correctly race1/member1, race1/member2, and race2/member1 nodes can all be created, so it's really the pair that is unique, not any given field.
No other module to suggest. Probably not what you're looking for, but an experienced drupler/php-coder could probably implement (ii) in a few hours.
a validation function would be added to the node form, which would try to load a node based on CCK content values. Something like this:
http://drupal.org/node/360541
If found, the validation would fail with an appropriate error message.
mtsanford: you understand my
mtsanford: you understand my requirement exactly. I'm not a developer (yet) just starting to get into php and Drupal so it's a shame this sort of functionality is not present.
Thanks
In fact the unique_field
In fact the unique_field module does allow to constrain on combined multiple fields. Exactly what I was looking for. I'll have to make some changes to the way it reports duplicates it finds but the basic functionality is there. :)