What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Creating a 7 digit number based on data and use

    Asked by kellyfisher on November 04, 2015 at 02:23 AM

    Is there a way to do auto prefix?

    I want to create an automatic job number that is 7 digits long.

    Digit 1 & 2 - would be the year (ex. 15)

    Digit 3 & 4 - would be the month (ex. 11)

    Digit 5, 6 & 7 would be sequentially automatic starting over at 1 each month.

    So if I did a request today it would 1511001 (first request of month).

    The next request would be 1511002 and so forth up to 1511999 (not that the requests go that high - they probably will seldom break 100)

    The first request in December would be 1512001...

    And the first request in January 2016 would be 1601001....

    I think you get it? Is that possible?  If the sequential part isn't, is it possible to do just the automatic prefix of the first for digits.  

    If not, I'll just have to manual start over every month.

    Thanks in advance.

    next create 7 digit number number stamp
  • Profile Image

    Answered by Ben on November 04, 2015 at 09:16 AM

    Unfortunately the option to have the numbers go from 0 to 999 each month is not available so this would not be possible.

    We do have Unique ID widget that can help for similar setup, but it would not restart the counter on specific date, meaning that this would need to be done manually.

    The first 4 digits would be possible, but you would need to create a workaround through the conditions to be able to pull the data in the way you need it, however if you create your form in the JotForm form builder and then just add the short JS code into the forms full source code on your website, it will work for you properly.

    This type of change would however mean that the code can not be added to the form builder, so each time you make some changes to your form, you will need to re-embed it on your website for your users to see the difference.

  • Profile Image

    Answered by grade4pagasa on November 04, 2015 at 01:01 PM

    Hi Ben.

    I got inspired from your reply to @kellyfisher

    Like what I always say when I contribute:
    I'm not a Coder / Programmer - so please bear with my logic & method :)

    The trick I used to get the YYMM value is via the composite of 2 SubString widgets. Then I used a Unique ID to generate 3-digit number starting at 0.

    And I just discovered this now (like just 15 minutes ago) - I used {yymm} field name and inserted it in the Unique ID Prefix field(fig. 1)
    How Cool is that ?!
    I just wish the Dev Team will implement the use of {field names} in all fields properties available - wink wink.

    I then setup the Thank You page to show the concatenated 7-digit number (which you can see by trying the live sample form). 

    To check if the Unique ID really worked, I checked my email and sure enough, the 7-digit number is there. (fig. 2)

    *** I still haven't figured out the bit about rebooting the counter every first day of month.

    You can see 2 screencasts for the 8th & 999th entry (i tried a couple of times to check if it works). (fig. 3 & 4)

    Again, apologies for the method :) Maybe you guys can make it efficient & effective?

    Note: I noticed that when using SubStrings, their values doesn't automatically reflect on either the Form Calculation field or the Textbox. It takes 3 calendar clicks to show the updated / real value of the calendar. That's why the Submit button will only appear if the YYMM values are filled (after 3 clicks in the calendar widget). As such, my method will not work if there'll be no interaction / manipulation with the calendar widget. Maybe the JotForm Support Team or any member of the Community have a better solution?

    - Randy

     

    (fig. 1) Unique ID Prefix field.

     

    (fig. 2)

     

    (fig. 3)

     

     

    (fig. 4)

  • Profile Image

    Answered by Ben on November 04, 2015 at 04:04 PM

    Hi Randy, nice to see you on our forum again and again with a nice sample of how it can be done :)

    Honestly I did not know that the Unique ID would accept the field tag as parameter since our developers only made it work with Text field. Having that said I am glad to see that it works, but feel that I should mention that it might not work at some later time.

    As I mentioned in my reply, the biggest issue is the resetting part, which we can not do as it requires logic that can only be applied to the source code, meaning that it will go from 0 to 999 and even then, it should go further up - not reset its counter to 0 since that already was shown.

    The alternative is to come into the form each month and manually set index of unique ID widget to 0.

    Now the reason why the form calculation does not get activated is because it awaits the change to be reported to it, so when such things are needed to be implemented where someone might not click again, conditions should be the way to go instead of Form Calculation as it would be updated faster.

    @kellyfisher The above would work, but as mentioned only if you are willing to manually reset the counter each month, otherwise a custom development would be needed.

    Randy, thank you again :)

  • Profile Image

    Answered by kellyfisher on November 04, 2015 at 06:04 PM

    Thank you for everyone's feedback.  I appreciate it.  I will probably stick to the manual reset every month.  It's a 10sec step, that i just need to remember to do.

  • Profile Image
    JotForm Support

    Answered by jonathan on November 05, 2015 at 12:53 AM

    This thread is very helpful and inspirational :) I'll leave it as is. 

    Feel free to contact us anytime should you need further assistance.

    Cheers