Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-07-30 19:16:55

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

how to make a custom field to be unique

i have crated a custom field, it’s name is serial . is it possible to make that unique? it mean don’t accept the repeated code on each article.
thanks TXP team :-)

Offline

#2 2015-07-30 19:26:59

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: how to make a custom field to be unique

One way would be to auto- fill that with the article id


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2015-07-30 21:40:36

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: how to make a custom field to be unique

This could be an XY problem. Please make sure you’re asking X instead of Y.

Offline

#4 2015-08-10 16:03:37

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

Re: how to make a custom field to be unique

it’s not XY question !
it’s clear and needed thing, sorry my english is not very well
i prepared a website to my client and that’s online tracking, i’ve installed wet_haystack plugin that can search through exact option, i chose a custom_field
then i write the serial of each tracking to that custom_field, then search box will find that article
but, now if the author entered duplicate serial of a tracking in to two articles, that should alert or reject.
i hope to understand
may be that’s impossible, but i saw many impossible things solved to textpatter, because of that i asked.
thanks

Last edited by raminrahimi (2015-08-10 16:05:36)

Offline

#5 2015-08-10 17:12:22

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: how to make a custom field to be unique

Wouldn’t it be simpler to user the article ID instead and not use a custom field at all? That is auto-generated and guaranteed unique, because it’s the primary key for the article table.

If not, how does the client/author generate serials and can you give an example of such a serial?

Offline

Board footer

Powered by FluxBB