The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Auto Increment

Labels

This Discussion is public

Notifications

I have a form that is supposed to generate a new number everytime a new entry is entered.  This is set up to be unique, but the form is stuck on the number I auto-start with and will not advance by 1, as is denoted in the fields.  I have to manually change the start number to the next number before my users can submit another form.  AJAX submission is turned off with this form.  I have another form that generates a unique case number and it seems to be working properly.


Attachment:

Are you saying auto increment is not generating a unique value when the form is saved in the database?

I tested the auto increment shortcode in my dev environment and it's working fine. Whatever is happening seems to be unique to your environment. I would check PHP version, look for plugin conflicts, or any PHP errors on the server or jQuery errors in the console.

The number you see when the form is loaded to the screen may not be the same number you see when the form is saved. This is from the docs:

The [auto_id] shortcode always returns a unique value. The final submitted value may end up being different from the value displayed on the screen when you first load the form, such as if there are multiple users filling out the form at the same time.

The auto increment value is checked at two different times to make sure it's unique:

First, the value is checked against other saved values when the form is loaded. It is possible that two people may be filling out a form with the same auto id value.
Second, when the form is submitted, the value is checked during validation against the latest value stored in the database and updated if the value has been used. There are cases when the auto id is not unique when two people submit a form in the same millisecond. This is rare, and can be prevented by marking the auto increment field unique. This will cause one of the two users submitting at the exact same time to resubmit, updating the value correctly.

Note: The [auto_id] shortcode is not set-up to work inside of repeaters

Thank you for you reply Victor.  I have another form in my environment that is generating a incremental number and its working fine.  Thats why I am so perplexed.  The problem is, when the form is saved, it only wants to use the number in the autoid start, it wont advance to the new number.

Discussion closed.