Hi, I am looking for help regarding code.
So I am currently trying to make a bike register in Velo, and everything is done except one thing.
I need to find a way to make a field in the database automaticly generate 3 letters and 3 numbers when a form is submitted. Let me explain.
So when a user wants to add a new bike to the system, they add a brand and an ID-number from the bike. Called “bikebrand” and “bikeid” in the database collection. This information is gathered trough a form for members only.
What I want to to is that when a new bike is added in the database from this form, the system should automaticly generate a license plate number like this “ABC 123” containing 3 random letters and 3 random numbers, that does not match any other existing bike in the database collection. I think this should be done automaticly when the form is submitted from the user.
So the process will be like this:
- User enters form page
- User fills in bike brand and bike ID number which is then getting stored into the database collection in fields “bikebrand” and “bikeID”
- User gets a success message of bike saved on the screen
- The system should then at the backend, automaticly generate a nonexisting liceneseplate number containing 3 random numbers and 3 random letters in the database in the field called “bikelicenseplate” (This is where I need help
)
Does anyone have an idea to what the script could be on the form page, to make this work?