Home > front end >  -solved- table only record one character of my form field
-solved- table only record one character of my form field

Time:11-12

One of my tables from pgsql has a strange behaviour like the title says.

Here are some screenshots:

Pgadmin one letter in column text

form field printed into vscode (server code works)

As you can see, the name zamdam must be record in the column "nom" in pgadmin instead of recording one letter for one column, here is the sql statement server code :

await client.queryObject("INSERT INTO users(nom,email,password,adresse,prenom) VALUES($1,$2,$3,$4,$5);",
        product.fields.nom,
        product.fields.email,
        product.fields.password,
        product.fields.adresse,
        product.fields.prenom
        );
        let nomFormRegister = product.fields.nom;
        console.log(nomFormRegister);

It was working well until I started to add some subtable behaviours between tables, but I deleted all of them and wrote new tables so I don't understand why this issue still appears ...

an other example where i logged in vscode all the fields that should be recorded in my table :

Form :

Form

SQL statement server code :

SQL statement

console.log :

console.log

PgAdmin table - fourth line:

PgAdmin table

CodePudding user response:

Could you try to run queryArray instead of queryObject for insert operation?

await client.queryArray`INSERT INTO users(nom,email,password,adresse,prenom) VALUES(${product.fields.nom}, ${product.fields.email}, ${product.fields.password}, ${product.fields.adresse}, ${product.fields.prenom}`;

I am not sure if it's gonna work, because I've no deno environment to test it.

  • Related