HELP AlphaNumeric Randomizer Please

Ok so I know the these questions have all been asked but I am not that great at code and I am new to all of it but learning as I go so heres my question if any one could help I would be greatly appreciative. PS cant Spell Unequivocally Dyslexic
On my sight I have a form that is to be filled out and it sends all the information to my dataset (that works great) but I then wanted to add an eleven digit code to the outcome of the form
I then put in a text box found some codes on this forum and I got it to come out with really large numbers randomly. But being my dumb self I started messing with it to see if I could get it to only be eleven charters long. And MUCKED it all up.
If there is any way that some one could explain or wright me the code I would be so gracious I wouldn’t know what to do. The text box is #text39 and idk if this is possible but can the outcome look something like this 23EG-KD5-65JD. But if someone could explain it to me that would be appreciated as well.
Thanks
J.A.

Try this:
$w.onReady( function () {
//TODO: write your page related code here…
console.log(ransomstr());
});

function ransomstr() {
function s4(size) {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(36)
.substring(1, size);
}
return s4(4) + ‘-’ + s4(3) + ‘-’ + s4(4) ;
}

1 Like


Well thank you Mis Dalia But i m still having rouble with it i pluged in the code and this is waht happend. and i wasnte seeing a place to substutute my text bock so it will go in a spacifick place (maybe im just blind ) lol but i do now thanks to u have a better understanding of the (hfgt-745hd8) thing which i am glad about. maybe i wante asking the right question idk but i do thank you for you help aready.

Looks like you’re missing a closing }

1 Like