PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Title field name + number

  1. Hello all,

    I tried using the pre_submission_handler to populate the first field of a form (title field of a post field) with values from another field (a name). That works.

    Now I want to add a number to it, like a counter. So that you get John001, William002, Sarah003, Mary004, Steve005 etc.
    How could I do this?
    Thanks

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink
  2. David Peralty

    You would have to find somewhere to track the numbers that have been used to know what comes next, and that's where the complexity lies. Do you keep an index table where you place in the last number used, grab that value and increment by one, and update the table, or do you use some other method of keeping track? That would be up to you.

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink
  3. My idea was to use a counter. So the next number will automatically be an unused number. I saw a counter script here on the site, but had now idea how to use that.
    I figured that it would be easy to do but obviously it is not?

    The idea of having the name added to the number is to make the URL unique. Otherwise, if you just use a number you could browse the people in the DB by changing the number in the URL.

    Posted 11 years ago on Tuesday June 11, 2013 | Permalink