Skip to main content

Custom field unique entry

More
3 years 8 months ago #348801 by khashiz
-- HikaShop version -- : 4.7
-- Joomla version -- : 4.2.6
-- PHP version -- : 8.1

Hi
is there any possibiliy that user custom field accepts only unique entries ?
I need to ask for users ID card number and two users with the same ID is not allowed

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #348806 by nicolas
Replied by nicolas on topic Custom field unique entry
Hi,

I've never tried it, but that should be possible. Go in your PHPMyAdmin, edit the structure of the hikashop_user table, and add a unique key on your custom field column and it should do it automatically.
community.appian.com/support/w/kb/693/kb...rneath%20the%20table .

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #348832 by khashiz
Replied by khashiz on topic Custom field unique entry
I tried to do that but did not managed to.

i got the attached error

unfortunatly i have to experience working with mysql

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #348833 by nicolas
Replied by nicolas on topic Custom field unique entry
Hi,

The error

BLOB/TEXT column 'codemelli' used in key specification without a key length

means you need to specify the length you want to take into account for the unique key because the column is of the "text" type.
So for example, you can use the MySQL query:
Code:
alter table ciofl_hikashop_user ADD UNIQUE(codemelli(100));
That way, it will only take into account the first 100 characters of the text in codemelli to be unique.
Basically, it depends on the length of the text you expect your users to enter in that field. But it's best to not make it too long.
The following user(s) said Thank You: khashiz

Please Log in or Create an account to join the conversation.

More
3 years 8 months ago #348840 by khashiz
Replied by khashiz on topic Custom field unique entry
Thank you very much dear Nicolas.

Please Log in or Create an account to join the conversation.

Time to create page: 0.208 seconds
Powered by Kunena Forum