Hey,

I've been looking around for a while but I couldn't find a solution so far. I created CCK content type with a texfield. It's possible to check the user entry for an already existing entry in the database. I want to avoid double database entries. For example UserA submits the textfield with the value "1234". Now UserB submits the same form (textfield) also with the value "1234". Now it would be nice if drupal could check the database column for the entry "1234" and shows UserB a message "Sorry the value 1234 already exists, please try another one". (to make it more clear, It's like sorry your username is already taken, same feature just another usecase)
Is there any module which I could use? Or php/mySql code customized for the textfield?

Comments

WorldFallz’s picture

PaulSchoen’s picture

Thank you so much! Works great!

PaulSchoen’s picture

Hey,

Is it possible to use the module for more than one contant type. What I mean is that if one user types in value"1234" in the textfield "xyz" and another user wants to put in "1234" in the same textfield / same content type it works great (the user gets an error). But if a user types in the same value "1234" in the same textfield but in another content type it doesn't work. So basically (textfield A / content type A) works! BUT (textfield A / content type B) does not!

Any suggestions ? Thank u soo much for your help.....

WorldFallz’s picture

I don't use the module myself, but right on the project page it says this is one of the settings....

ColdSun’s picture

You could use a mixture of the flexinode module in addition to the previous mentioned unique field module I would imagine.

PaulSchoen’s picture

Hey,

I can't find the mentioned sentence "this is one of the settings...." so what do u actually mean?
@ColdSun Could u explain how to use it in combination with the flexinode module? I'm using Drupal 6.19 btw...so i read that it's now kind of implemented in CCK..?
I really appreciate your help....

ColdSun’s picture

I must of been mistaken. I had assumed the module I was referring to was flexinode. However, its quite apparent that I was wrong as that is for a far earlier release. http://drupal.org/project/flexifield Seems to be what I was referring to.

Ideally you would create 2 fields (or however many) under flexifield, and then set that larger field to be unique.

WorldFallz’s picture

The administrator may choose whether the fields must be unique among all other nodes, among nodes of the same content type, or of the same language.

If you click on the screenshot you can see exactly what the setting you're looking for looks like.

and i have no clue why coldsun would point you to flexinode-- it's an v4-something module that no one uses and that will not help with this issue in any way whatsoever.

ColdSun’s picture

As mentioned in my reply after, I had meant flexifield.

rok82’s picture

I have a similar problem then the one above since I have a custom CCK content type called "equipment" where users post equipment request.
I want drupal to check whether a specific equipment is already on stock...it means to check 2 custom fields:
1) Product name
2) Status
To cut it short if a specific product name is set status "on stock" to have it perform specific actions. I have tried same with the rules module and PHP code but cannot manage the PHP code to check the conditions...Anybody has any sample code?
Thanks in advance!