How to autogenerate 10 unique random number in text filed

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
maxikay
User
Posts: 6

How to autogenerate 10 unique random number in text filed

Post by maxikay »

Hello all,

I need help to auto generate random unqiue numbers on a text field once add button is click.
Random unqiue numbers should be 10 or 12 digit.
It will be use as for QRcode display in List.

Thanks in advance.


arbei
User
Posts: 9356

Post by arbei »


maxikay
User
Posts: 6

Post by maxikay »

Thanks,

i got this script below working. but stuck on how to insert the random number into the text field when add is click for new record.

<p id="demo"></p>

<script>
let x = Math.floor((Math.random() * 1000000000000) + 1);
document.getElementById("demo").innerHTML = x;
</script>

Need help to insert this into the text field any time new Add record is click.

Thanks in advance


arbei
User
Posts: 9356

Post by arbei »

  1. If you use client side JavaScript, you may use Startup Script.
  2. If you use server side PHP, you may use Row_Rendered server event.
  3. To generate random number by PHP, you may use random_int().

Post Reply