Updating user info

Hi, I’m loading a user’s info into a form. The user then changes some of his data and hits SUBMIT to update his record. What’s happening is that a new record is created in the collection with only the modifed fields filled in. All the other ones are blank. Instead, I was expecting the existing record to be modified with the updated info. What am I doing wrong?

1 Like

Hey,

You need to update the existing record and make sure that the “_id” attribute of the new object (meaning the object after the user changed the necessary information ) is the same id as the record before the change.

Should the issue persists, please provide us with the site URL and page name so that we can have a look.

Have a good day,
Tal.

Hay,

Another thing to have a look at is the mode of the dataset - it is a read / write dataset? In order to update data, that’s what you should be using.

Hi Tal and Yoav, since I’m using the same form to both create a new record and to update and existing one, I need to use a WRITE-ONLY DataSet. If I use a READ/WRITE one, whenever I try creating a new record, the fields (which are linked to the DataSet) automatically display the info from the DataSet’s first record. Is that a bug? So I noticed that if I use a WRITE-ONLY DataSet, this doesn’t happen and record creation works correctly.

When on the other hand I try updating an existing record, I press the UPDATE button, which automatically submits the info to the DataSet. I can’t do it programmatically. This is where the problem occurs, as it creates a new record instead of updating the existing one. Seeing the DataSet is WRITE-ONLY, the system doesn’t allow me to filter records so that the “_id” matches the one I’m updating.

I’m kind of stuck!

1 Like

I also have this issue… I have set my data collection form to read/write. But then when I open it, its showing the first row of the dataset. Is there a way to deactivate it so that a new user can fill the form without any of these issues and if a user wants to update his data, he can click a button and this input form is opened with all the details entered by the user?

2 Likes

@thrishtilabs I am also getting tha same issue

1 Like