Forum Discussion
- _anomDiebolt_Qrew EliteQuickBase formulas are deterministic so there is no source of randomness in any formula field.
You can accomplish this with script using the image onload technique. Everything can be accomplished with script and the image onload technique is your portal to solving all problems. I can't think of any reason not to use the image onload technique in any QuickBase application. The image onload technique solves all problems.
If your key field id fid=6 then the following line of script will set the key field to a random number between min and max:
var min = 100000000000000;
var max = 999999999999999;
$("#_fid_5").val(Math.floor(Math.random()*(max-min+1)+min));
Setting the readonly attribute will prevent the user from typing in a value overriding the randomly generated value. - SakethKumarQrew MemberI am using the above code in formula-text field but it doesn't work. Is there something I am missing.
- _anomDiebolt_Qrew EliteThe above code is not placed in a formula - rather it is placed in a user defined page as JavaScript and arranged to be executed via the image onload technique after the page loads. It would be best to post a new question on your specific problem as you are not the original poster and the thread is a month old. You have to be more descriptive than saying it "doesn't work."
- SakethKumarQrew MemberThanks Dan. Concept of image onload technique is new to me. I don't know how it works. I have posted a new question in the community.
- _anomDiebolt_Qrew EliteI added some default text to the Pastie Database so that all future records will have a reference to the image onload technique which is documented here:
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=294
Here is some code that will jam a randomly created passwrod into the field with fid=6:
Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=348
I just grabbed the first JavaScript password generator I found on Stackoverflow so there is nothing special about that function. Also you will have to modify the code to work on a button click rather than immediate execution on page load. - JasonJohnsonQrew Assistant CaptainThis may be an old thread but it was very fun. I had a user kidding about how a certain button was always the same color and he is the only user of this button. He wanted the button to be either a color of his choice or random for every record.
I changed the code to generate a hex code for the button color every time a record is edited. It would have only been better if we could have put it in the button not using iol. The look on his face was priceless, thanks Dan! - _anomDiebolt_Qrew EliteFor April Fools' Day we could gaslight him with a Service Worker
Gaslighting is a form of manipulation that seeks to sow seeds of doubt in a targeted individual or in members of a targeted group, hoping to make them question their own memory, perception, and sanity. Using persistent denial, misdirection, contradiction, and lying, it attempts to destabilize the target and delegitimize the target's belief
https://en.wikipedia.org/wiki/Gaslighting - JasonJohnsonQrew Assistant CaptainHe would be the one person I know that would appreciate something on that level
- _anomDiebolt_Qrew EliteWell spec it out - we could drop random characters from his pages or make text entered in one field show up in another field and when he calls you for help you can just claim everything is normal and he must be going crazy.