Wix form Customization [Solved]

Hi everyone, I built a form on my website where applicants must fill a multistep form to apply for given courses. However, I would like to give a reference number for the applicants once they submit the form as to follow up their application status over the phone by giving the admin the reference number assigned. Moreover, I would like to limit the email submitted to one application only. In other words once the applicants apply using his email, he cannot apply for a second time using the same email.
Your cooperation is highly appreciated.

Anyone can help please.

Hello Mahmoud :raised_hand_with_fingers_splayed:

You can do so by creating a random number, and then insert it with the form values, here’s an example:

const requestId = Math.floor(Math.random() * 10000000000)

Then insert the requestId or set its value according to your code syntax.
Read more on each link above and use the one that suites you the most.

Ahmad

Thanks ahmad for the reply. much appreciated. I will check it now

You’re wlcome Mahmoud.

If your problem is solved, please edit the title of this post to include the [Solved!] tag.

For the submit form only once option, check out this previous form post and the answer given by Mike.
https://www.wix.com/corvid/forum/community-discussion/code-to-allow-user-account-to-fill-a-form-just-one-time

With the random number, it might just be easier to add something to the pages onReady function so that it adds a random number in a read only user input when the user opens the form page and then you can save this to your forms dataset through the forms submit button.

Just add a user input, set it to read only so that it can’t be altered by the user themselves and connect it to the field in your dataset where you want this unique reference to be stored…

Something like this.

$w.onReady( function() {
function randomNumber (len) {
var x;
 var n = '';
    for(var count = 0; count < len; count++) {
        randomNumber = Math.floor(Math.random() * 10);
        n += randomNumber.toString();
    }
    return n;
}
$w('#formId').value = randomNumber(10);
});

Just change #formId to the id name of your user input.

I had done similar on a multipage example for a previous forum user here.
https://givemeawhisky.wixsite.com/testing

Thanks GOS. Appreciate all the help