Log In

Log In

Not registered yet?

Reset password Activation link

Forums ~ FAQ's

Random ID #

March 2, 2016

March 2, 2016

I need to figure out how to create a random ID # with a 2-letter pre-fix for each member.

I’m going to create registration forms and will have to have these unique member ID #’s to generate and
send an automated email to the registered new member with the new number.

Igor Petrushenko
March 2, 2016


1. Assign CSS class name for your ID field, let’s say “random”.
2. Add new field to your form with ‘Description text’ type and enter as a field name JavaScript code:
<script> function randomInteger(min, max) { var rand = min + Math.random() * (max - min); rand = Math.round(rand); return rand; } var uniqID = "PF" + randomInteger(1,1000); $('.random input').val(uniqID); </script>

This way when form loads it executes JS code in this description field, which assign random value with ‘PF’ index to your .random field.

Share the discussion in the social networks: