Custom field unique entry

  • Posts: 197
  • Thank you received: 13
1 year 2 months ago #348801

-- 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.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
1 year 2 months ago #348806

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.

  • Posts: 197
  • Thank you received: 13
1 year 2 months ago #348832

I tried to do that but did not managed to.

i got the attached error

unfortunatly i have to experience working with mysql

Attachments:

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
1 year 2 months ago #348833

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:
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.

  • Posts: 197
  • Thank you received: 13
1 year 2 months ago #348840

Thank you very much dear Nicolas.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum