Unable to Update a particular field in database

Unable to Update a particular field in database

 
We have to update a single value of the field in Database,
But now the issue is when we updating the field the row get empty and after that the updated value come in that field.
PFA of the password change field Database
As you can see on the above image the above two rows get empty and the updated value are now in the field like "abc" and "shahrukh123" with Mr. in that
You can also find the code of that
Also find the attachment of our front-end
We are stuck in this
We have also refer your https://www.wix.com/code/reference/wix-data.html#u...this page but doesn't work for us,


It should be something similar to this function:
export function button1_click_1(event, $w) {

 let username = $w('#input1').value;
 let password = $w('#input2').value;

 wixData.query("Change_password")
  .eq("username", username)
  .find()
  .then((results) => {
   let Id = results.items[0]._id;
   let oldPassword = results.items[0].password;

   //adding all the fields of the record 
   let toUpdate = {
    "_id": Id,
    "title": "Mr.",
    "username": username,
    "password": password,
    "changedPassword": oldPassword
   };
   
   updatePassword(toUpdate);
  });
}


function updatePassword(toUpdate){
    wixData.update("Change_password", toUpdate) 
 .then((results) => { 
  console.log("item was undated sucessfuly"); 
 }) 
 .catch((err)=>{      
  console.log(err); 
 });
} 
SHARE

Oscar perez

Arquitecto especialista en gestion de proyectos si necesitas desarrollar algun proyecto en Bogota contactame en el 3006825874 o visita mi pagina en www.arquitectobogota.tk

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comentarios:

Publicar un comentario