Quote ID Generator Button
- July 8, 2022
- 1 reply
- 830 views
I am createting a pdf form that has a unique field and button. The field is called "ID" the button is called "Generate Quote #"
That i have managed so far is that pressing the button will generate a random number in the ID field, however, i have noticed when testing that the # is not always the same length digit wise. I would like it to always be 13 digits. Therefor I want to add a way to add extra 0's at the end of the number string so it will always be 13 digits. I dont know if i should add this to the button, or ID field propoerties under Calculate so it takes the number generated and clacualtes it to be 13 digits. ive tried a few methods but they all seem to breeak the number generation.
Here is the Action on Mouse up javascript for the button;
this.getField("ID").value = (Math.floor(Math.random()* Math.pow(10,13)));
if (this.getField("ID").value == "") this.getField("ID").value = (Math.floor(Math.random()*Math.pow(10,13)));
