ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Yearly unique entry ID formfield

April 01, 2011 9:26am

Subscribe [2]
  • #1 / Apr 01, 2011 9:26am

    the jan

    30 posts

    Hi,

    I have just received a request for a new EE website, which is great. But the request also includes a unique fieldtype. The fieldtype is an automatically generated ID. The ID is based on: year of entry, complete number of entered ids to a specific channel, entry number of the year, like: 2011-0001-01 [year-number_based_on_cannel-id_of_entry_per_year].

    I know how to figure this out using PHP/MySQL. Does someone know of an EE solution or an EE field which works in a similar way?

    Or otherwise: How can I insert a field on creation of an EE entry by default? Or: How can I automatically fill an EE entry field upon loading an entry form for a specific channel? (I would think it works nearly like the URL title field)

    Thanks,
    Jan

  • #2 / Apr 04, 2011 12:42am

    Cheif

    626 posts

    Not being a big PHP anything, I’d look at creating a Safecracker form for all new entries, have a hidden field and populate it with your php code and submit it.

    It would mean NOT letting the clients to use the backend for entry but could achieve your requirements. Just make sure you have a custom field to hold it 😊

  • #3 / Apr 04, 2011 4:29am

    the jan

    30 posts

    Thanks for your reply.

    I have now solved this by sitting down and looking into EE add-on development and developing my own fieldtype. I wanted to do this anyway and now had a good reason to do so. 😊

    Now I need to see if this solution works out, but if someone is interested in the code I’ll gladly share it.

    Jan

  • #4 / Apr 04, 2011 8:10am

    Mark Bowen

    12637 posts

    Now I need to see if this solution works out, but if someone is interested in the code I’ll gladly share it.

    Jan

    Let me be the first to say that I think it’s great when people share code so that others can learn from it so if you’re okay with sharing it then by all means, please do 😉

    Best wishes,

    Mark

  • #5 / Apr 20, 2011 8:58am

    joost

    62 posts

    @The Jan,
    could you share the code? I’m looking into a solution to generate unique product id’s in Products channel. The entry_id is unique but is shared across all channels.

    I appreciate you help.

    Regards,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases