-1

I want to generate a unique code (like: xxxxxxxxxxx xx) onsubmit form. after completing the information in the registration form,the application will generate a unique code in an ouput on an other form.

nes
  • 1
  • 1
  • I would suggest use java and not javascript for generating unique id, since you area already using jsp. – Amit Pandey Nov 26 '12 at 14:25
  • Generally speaking, it's common practice to perform this kind of logic server-side. Is there a particular reason for your approach? –  Nov 26 '12 at 14:26

2 Answers2

0

Using javascript math.random() is your most straight choice :

var random = (Math.random()).toString().split('.')[1]
Dave Loepr
  • 946
  • 1
  • 7
  • 13
-1

There are some already answered posts in response to your query -

Generate unique ID

or you can refer here - http://www.javapractices.com/topic/TopicAction.do?Id=56

Community
  • 1
  • 1
Amit Pandey
  • 1,436
  • 2
  • 24
  • 34