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.
Asked
Active
Viewed 2,138 times
-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 Answers
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 -
or you can refer here - http://www.javapractices.com/topic/TopicAction.do?Id=56

Community
- 1
- 1

Amit Pandey
- 1,436
- 2
- 24
- 34
-
i know that, i was going to suggest to the person to use java and not javascript. – Amit Pandey Nov 26 '12 at 14:26