• I’m using the following javascript to generate a random number from a form. This is then used as a unique ID number field. Problem is it seems to fail about 10% of the time. Not sure if its failing from specific devices or browser settings. Is there a better or more reliable way of generating a number?

    <input id="ID" name="Application_ID">
       <script type="text/javascript">
       document.getElementById("ID").value = Math.random();
       </script>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Not sure what you mean by “fail”? I’ve run your code and it works perfectly every time for me. What devices or browser do you notice it to “fail”? Are you noticing it on a page refresh or some other action.

    Have you asked your question on stackoverflow.com which deals with this kind of issue?

    Thread Starter brother

    (@darshi)

    Thanks @dccharron, I haven’t been able to duplicate the fail, but sometimes the form comes through and the Application_ID is blank, it happens maybe 10% of the time.

    I will try over at stackoverflow.com

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Generate Random Number’ is closed to new replies.