I want create a user input field wich already contains a number in it. It can be a ascending number or a totally unique number in a specific range. Are there any solutions for this?
1 Like
Hi Rutger, I also have this function in my website, just add a beforeinsert hook in your database
export function regdog_beforeInsert(item, code) {
let hookContext = code;
item.code = randomNumber(10);
return item;
}
function randomNumber(ran) {
var n = '';
for (var count = 0; count < ran; count++) {
randomNumber = Math.floor(Math.random() * 10);
n += randomNumber.toString();
}
return n;
}
please i need a counter that add up my visitors points once they click on any survey or link on the dashboard.
Hi Geo, Hope you there after three years for your comment solution. I would like to know how to put this code in dataset field. I am a novice in code world. Need your help. I want a field (name suppose ‘index’) this field should contain or copy index number as data/value. Thanks and regards. : )