• Hi, is it possible to add, I tried this tutorial https://wpmudev.com/forums/topic/field-to-generate-random-numbers/ but it seem doesn’t work, or may be I did something wrong.

    What I did:
    1. Copied the code given here:https://gist.github.com/wpmudev-sls/5c8213b37d4ef2730c57e3822c3fe5a7 and put it in to code snippet (because I don’t know where to put the code file)
    2. Insert a hidden field, and in its’ settings, add a “Label” like “Tracking ID“, select “Custom Value” at “Default Value (optional)” and leave “Custom Value” field with no value (as it will be auto filled).

    Before using the snippet be sure to update $form_id and $form_field values to match your form’s settings.

    private $length = 6;
    private $form_id = 1100;
    private $form_field = ‘hidden-1’;`

    can you please give me some advice regarding this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @readonecc,

    I hope you are doing well today!

    I checked the mentioned code with the latest Forminator and it is still working well.

    You need to add this code to your site as a mu-plugin.
    More information can be found below on how to use mu-plugins.
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Variable $length represents the number of characters in the number which will be randomized. For 6, it could be 987456 and for 5 it could be 45879 etc.

    You will change $form_id variable with yours. Form ID is the same with the one used in shortcode as ex [forminator_form id="1408"] it is 1408 here. You can also see it at the end of your URL when you click Edit on form such as ..&id=XXX

    Kind regards,
    Zafer

    Thread Starter Mohammad Ridwanullah

    (@readonecc)

    Amazing, it works.
    But can I make it leading zero sequence number?
    Like 000001 and then 000002 …..? thank you

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @readonecc

    The code that you are using is meant to make a random number so it’s not quite a “sequence”.

    There’s another code that you can use instead which would give you a sequential numers “per form” and let you set how many leading zeros should be there and if to use some additional prefix/suffix.

    Note though: the difference is, the number here is sequential and not random and it is “per form” (so if you have two forms using that – they both can have same numbers):

    https://gist.github.com/adczk/fbf06b6abf7753df6b37234b13041e79

    Best regards,
    Adam

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @readonecc ,

    We haven’t heard from you for some time now, so it looks like you don’t have any more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Random Unique Number on Submission’ is closed to new replies.