Reahcing The Variable

Hello I have a simple problem to insert() a data into a database.


I’m trying to reach email and discordName but these are in code block so I can’t reach them. The problem source is when I write just

let discordName = $w("#discordName").value;

The code doesn’t insert anything when I write it like that because I need onchange for textInput item how can I fix this?

Hi ExWeiv,

First of all, Next time add the code in a code snippit.
its easyer for us to help you.

Second,
Don’t add functions in the onReady() function code block.
Add them below.

Third,
email and discordName aren’t public variables since they are created in a function.
Nothing else then the function itself can access them.
What you can do is add empty variables under your import’s
then change them in the function.

Fourth,
If you wanna trigger when changing, go to the properties of the element (right side of the code)
Go to the onChange event handler and click it, it will automaticly give it a name and if you press enter there will be a code block added to the code.
code in there will run when chaning that element.

Kind regards,
Kristof.

@Kristof I’ll try these things and I’ll reply if it’s work.