This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

A way to autoincrement the number field?


  1. haizlid
    Member

    One of the elements or fields available on the form is number. Is there a way to automatically have this number auto-incremented +1 every time the form is accessed?

    Thank you.

    Posted 16 years ago #
  2. yuniar

    Hmm.. this sounds simple, but it requires pretty much code changes.
    I suggest to just use the "id" column on your table. The "id" is already auto-incremented.


    MachForm Founder

    Posted 16 years ago #
  3. haizlid
    Member

    yes, but the only problem with that is if an entry is deleted then all the id's are renumbered. So if you're trying to keep track of an entry by id - over time (after various entry deletions) the entries will no longer correspond to their original id.

    Posted 16 years ago #
  4. yuniar

    Actually, if you checked directly into your mysql table, those ids aren't being renumbered. Only the display in machform entries section is being renumbered.

    I suggest to wait for version 2, next week. It will use the unique autoincremented number from the table. So it won't be renumbered when you delete some of the entries.


    MachForm Founder

    Posted 16 years ago #
  5. haizlid
    Member

    Well that sounds terrific - one more request then please: Is it possible to somehow show that id number on the form?

    thanks

    Posted 16 years ago #
  6. haizlid
    Member

    And also (and maybe I've missed this somewhere) but the technique I've used to link to the form is copying / pasting the url generated by clicking 'view form' from the admin area.

    The only thing about this is that the link will always point to the id I've copied/pasted; for example:

    http://localhost/machform/view.php?id=2 (id is 2 in this case, obviously)

    Will this cause a problem when I'm using this as the redirect url in the 'successful submission' element? (I want to use this as the redirect url, by the way, because I'm using MachForm as a help-ticket scheme and I'd like for the enduser to have the option of successive submissions of tickets).

    thanks

    Posted 16 years ago #
  7. yuniar

    So you would like to redirect from one form to another form?
    Shouldn't be a problem, the redirect url can be any URL you like.


    MachForm Founder

    Posted 16 years ago #
  8. haizlid
    Member

    Would there also be a way to have the session id number appear on the form?

    Posted 16 years ago #
  9. yuniar

    you mean form id or session id?

    either way, yes you can display it on your form. it's a simple hack.


    MachForm Founder

    Posted 16 years ago #
  10. haizlid
    Member

    Yes, I suppose I mean the corresponding 'form id' as seen in the id# field of the manage entries screen.

    I suppose I could read up on how to go about this - but if it's especially simple, would you mind sharing how I might do this?

    thank you.

    Posted 16 years ago #
  11. yuniar

    sure, mail me when version 2 is released. I'll show you how.


    MachForm Founder

    Posted 16 years ago #

RSS feed for this topic

Reply