Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    JPP
    JPP is offline
    New Coder
    Join Date
    Jan 2012
    Posts
    28
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Exclamation Javascript that returns a random number, from a PREDEFINED list of number.

    When an agent completes an enrollment, I need them to be able to click a button, have this button generate a random number (into a form box), from a pre-defined list of numbers, and that number cannot be used again. Ever. I also need the button to gray out after receing ONE number. A cookie will need to be setup in case they hit F5 and refresh. I need the charachters to go as high as 6 digits, ATLEAST. The list it pulls from, must be pre-defined, we have to be able to acknowledge the number has been used, and cannot be used again.


    Example (List) :
    1A

    to

    10012A

    This would be a list I create, and it has to follow that list.

    Please help!! Javascript

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Location
    London
    Posts
    152
    Thanks
    4
    Thanked 42 Times in 42 Posts
    If its an Enrolment application, it must have a server and a database ??
    And for enrolment, the process should be -
    1) Person fills up the online enrolment form
    2) On submit, he/she gets a confirmation message along with a unique enrolment number for future reference.

    Then, why don't you make use of the database to query and return you next unique number ? i.e. once data stored, you can make use of the numeric primary key and add suffix as 'A'.

    You don't even need a JavaScript for that !!!
    (Though it can be used for making back-end call for submitting the form etc.)

  • #3
    JPP
    JPP is offline
    New Coder
    Join Date
    Jan 2012
    Posts
    28
    Thanks
    5
    Thanked 0 Times in 0 Posts
    We do all enrollments telephonicly. We do have a database and use it. They problem is we carry only thrid party insurace. And have to be able to communicate with them, in the same way, without giving them access to our database. Also, are script, where this number will be housed, is on the net, a webpage. It will act as a unique identifer. And we have OVER 500k enrollments a year, it gets tricky.

  • #4
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    500k per year (that is about one every minute) and no money to pay someone to do this job right? Who maintains a system as big as that and can't solve such a simple problem?

  • #5
    JPP
    JPP is offline
    New Coder
    Join Date
    Jan 2012
    Posts
    28
    Thanks
    5
    Thanked 0 Times in 0 Posts
    I think that depends on how many agents you have smart guy. Thanks for no help at all!! What are you even doing on here? Sitting around second guessing people? Sounds like youve got to much time on your hands. Thanks for nothing!

  • #6
    JPP
    JPP is offline
    New Coder
    Join Date
    Jan 2012
    Posts
    28
    Thanks
    5
    Thanked 0 Times in 0 Posts
    It also seems you have never heard of a typo before. Sure you can even code? And Im not sure its efficent, in this enconomy to hire someone for one piece of code. Not smart all around man.

  • #7
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,980
    Thanks
    56
    Thanked 557 Times in 554 Posts
    hmm. Well, apart from all that I think as has been suggested that you can't do this just with javascript. JS will never know which number has already been assigned by another agent, or even which number the same agent assigned three enrollments ago (well, it could, but it would be kind of useless for the task in question).

    It seems to me that the easiest way to do this would be to generate your list of random numbers first, populate a DB on the server with that list, then every time an enrollment gets registered, assign it to the next empty row and ask the server what that row's random number is. Or if you want it to be completely disconnected, just flag that row as "taken" and get the number.

    I don't understand the bit about insurance, or why that number would have to be kept separately from the actual enrollment record, but I guess you have your reasons.

  • Users who have thanked xelawho for this post:

    JPP (06-27-2013)

  • #8
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,695
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    JPP, I have to agree with Airblader here (although the tone is debatable), CodingForums is not a free coding service. If you show us some effort of your own people here are certainly willing to help. But to just request some program to be written we have a marketplace section, and this is where I’m moving this thread now, since I don’t expect you have anything to show to us.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •