Wix Code Problem : Trying to have custom password in form submitted only when it matches a list of passwords.

Hello , my name is Chris and i own a website created on wix hosted on the domain name TheKnightEmpireGlobal.com.

It’s a Record label / Recording Studio site.

I myself is the CEO of the company and i am also a Rapper, Music Producer and event promoter.

i have this member page called OneGangPro , where members can enter their TKECode ( it is a serial or password inside the albums boxes , and official products of the company ) to register their products and such…

I have zero experience in any coding at all ( reason why i’m on wix ) , but as you can see i’m trying to set up the Wix Coding to be able to " recognize" all the diferent passwords on our products .

What i want is the form to only submit to the database , when the characters typed in the "TKEcode " input match with one in the list of thousands of other codes . ( codes are 8 characters long and only contain lowercase and numbers)

but i’ve been using the default “12345678” password to test the code . that is here :

$w.onReady(function () {
  $w("#tkecode").onCustomValidation( (value, reject) => {
    if( !value.endsWith('12345678') ) {
 reject("Votre TKE Code est invalide");
 }    
  } );
});

as you can see i use

if( !value.endsWith

because i don’t actualy know how to make it be the exact character ( told you i don’t have any background in coding at all )…

but the most frustrating stuff is that i can only list one code which is “12345678” ,
i don’t know AT ALL how to LIST ALL MY 1000’s TKECodes in there…

i would also like to get a message saying that the code is invalid if it is not one of the codes listed and one that says that the code is valid and that the product has been successfully registered…

Could you provide me the code that would actually get it working proprely please ? thanks.

Simple solution would be to add an array with all your codes in a data collection first, then you use the onBlur event on the input field and get the .value and validate it inside the data collection and if it matches you enable the submit button, if it does not match keep it disables and show a message.

What code do you think you might need? All?

1 Like

Oh you are soo nice dude :wink: yes if i could have all codes that you can provide, that’d be awesome . Please show me how to do it the easiest way possible as i’m a complete noob in coding :smiley:

Hello ?

@bluefiretm Will you have them in a data collection and If yes please make sure the passcode is stored in the title field for conv when I try to write code

@andreas-kviby
Hey , nice to talk to you again, excuse me but , i didn’t quite understand what you’ve just been saying. Do you want me to provide you the pass codes , then you add them to a data collection , then when you write the code you will include that data collection directly ? if yes , then just remplace all the different passcodes by " 12345678 " in the data collection and when i will copy and paste the code you’ve provided i will change them directly . ( since there is like around 1000 codes just put like 5 “12345678” in a sequence and i will add all of them manually following the sequencing ( if there is another way to add the 1000’s at once , that’d be great too )).
And excuse me , i didn’t understand this sentence : " please make sure the passcode is stored in the title field for conv when I try to write code " …
Reminder : - There is like 1000 passcodes that have to be stored.
- what title field are you talking about ?
thanks :slight_smile:

@andreas-kviby u there ?

@bluefiretm Yes, if you can’t create the data nor code anything I would strongly suggest you go to Wix Arena and hire someone to help you. I could, but it would cost you. You can always click Get help! On wixshow.com.

if you want to do it yourself start off by reading all the Articles about Data Collections in this top level menu under Resources.

From Bluefire in wrong post
/////
yes , i want to but you didn’t reply to me again on the original one , this is what ive said :
Hey , nice to talk to you again, excuse me but , i didn’t quite understand what you’ve just been saying. Do you want me to provide you the pass codes , then you add them to a data collection , then when you write the code you will include that data collection directly ? if yes , then just remplace all the different passcodes by " 12345678 " in the data collection and when i will copy and paste the code you’ve provided i will change them directly . ( since there is like around 1000 codes just put like 5 “12345678” in a sequence and i will add all of them manually following the sequencing ( if there is another way to add the 1000’s at once , that’d be great too )).
And excuse me , i didn’t understand this sentence : " please make sure the passcode is stored in the title field for conv when I try to write code " …
Reminder : - There is like 1000 passcodes that have to be stored.
- what title field are you talking about ?
thanks :slight_smile:
you didn’t reply anymore that’s why i had to duplicate
/////