@rishalsharma
Yes it does not have to be profile data, it can be anything that you want to put on those pages for the site member to be able to see and change etc.
For it to work, all you need to do is to put some user data already on it. You can simply have a read only user input field that is automatically filled with the user id or something else.
This user input can be hidden on load so that the user doesn’t actually see it or you can incorporate it into your page design, it is your choice.
Then the site member will be able to use the page button and go to the update page as you will have something on the page.
Otherwise you can create a page where your site members can fill in this form before they get to their dynamic pages, then you can simply save the user inputs into the dataset from the tutorial and it will display the results already on their first page.
Or, you just go with your backend route and add that so that it displays info etc.
@givemeawhisky Lovely. Nothing more beautiful than a logical explanation
Thanks… I think I now understand what’s required. Having said that, I’m a newbie to coding. Any possibility you can help my following code?
In the first read only page, on clicking of a button, I’ll check whether there exists any data for the current user.
If yes, I’ll just route them to the 2nd dynamic page, for updating.
If NO, I’ve created a dummy field with key=dummy. And I’ll set it to a random value 0.
And then I’ll route them to 2nd dynamic page for updating.
Trying to learn from the code available at https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area
(Fyi my dataset is called Messagedata and the new dummy field is called dummy)
export function button1_click(event) {
return wixData.query(“Messagedata”)
.eq(“_id”, user.id)
.find();
results => {
// if an item for the user is not found
if (results.items.length === 0) {
// create an item
const toInsert = {
“dummy”: 0,
};
// add the item to the collection
wixData.insert(“Messagedata”, toInsert)
. catch ( (err) => {
console.log(err);
} );
}
}
. catch ( (err) => {
console.log(err);
} );
}
//Take user to the 2nd dynamic page
export function dataset1_afterSave() {
[wixLocation.to(“/](wixLocation.to(”/<provide) newpage ")
}
So just follow the tutorial and instead of adding Members as the dataset, simply add your dataset name instead.
You are over complicating things by having the user go to their update page straight away, you should just have the user go straight to their normal page so that they can see what that page and then decide to update through the update page if needed.
Like you have said, it is not mandatory what the user chooses to input, so some might choose to not add anything extra and just leave it as it is.
So with you moving the user straight onto the update page, you are technically forcing their hand and making it sort of mandatory that they add or update things on that page etc.
As for the tutorial itself, the code will check your dataset and see if there is already a member with that email and userid and if there isn’t it will insert the member into the dataset with their userid and their email.
You are then just better off directing the logged in user to their display page so that they can choose themselves whether or not they want to proceed and update anything or just go elsewhere on your website.
export function profileButton_click(event) {
wixLocation.to(`/Members/${wixUsers.currentUser.id}`);
}
So the code should look something like this, obviously change profileButton name to whatever your button is on your page. Plus, make sure that you add the onClick event handlers for the buttons through the properties panel for that element and delete the additional code that is added to the bottom of your page code as you will already have it.
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady( () => {
if(wixUsers.currentUser.loggedIn) {
$w("#loginButton").label = "Logout";
$w("#profileButton").show();
}
else {
$w("#loginButton").label = "Login";
$w("#profileButton").hide();
}
} );
export function loginButton_click(event) {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w("#loginButton").label = "Login";
$w("#profileButton").hide();
} );
}
// user is logged out
else {
let userId;
let userEmail;
// prompt the user to log in
wixUsers.promptLogin( {"mode": "login"} )
.then( (user) => {
userId = user.id;
return user.getEmail();
} )
.then( (email) => {
// check if there is an item for the user in the collection
userEmail = email;
return wixData.query("MessageData")
.eq("_id", userId)
.find();
} )
.then( (results) => {
// if an item for the user is not found
if (results.items.length === 0) {
// create an item
const toInsert = {
"_id": userId,
"email": userEmail
};
// add the item to the collection
wixData.insert("MessageData", toInsert)
.catch( (err) => {
console.log(err);
} );
}
// update buttons accordingly
$w("#loginButton").label = "Logout";
$w("#profileButton").show();
} )
.catch( (err) => {
console.log(err);
} );
}
}
export function profileButton_click(event) {
wixLocation.to(`/Members/${wixUsers.currentUser.id}`);
}
I’ve used that tutorial as a starting point for a members only area on a website…
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady( () => {
if(wixUsers.currentUser.loggedIn) {
$w("#loginbutton").label = "Logout";
$w("#membersareaonlystrip").expand();
$w("#whitegapforfooter").hide();
}
else {
$w("#loginbutton").label = "Login";
$w("#membersareaonlystrip").collapse();
$w("#whitegapforfooter ").show();
}
} );
export function loginbutton_onclick(event) {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w("#loginbutton").label = "Login";
$w("#membersareaonlystrip").collapse();
$w("#whitegapforfooter ").show();
} );
}
// user is logged out
else {
let userId;
let userEmail;
// prompt the user to log in
wixUsers.promptLogin( {"mode": "signup"} )
.then( (user) => {
userId = user.id;
return user.getEmail();
} )
.then( (email) => {
// check if there is an item for the user in the collection
userEmail = email;
return wixData.query("Members")
.eq("_id", userId)
.find();
} )
.then( (results) => {
// if an item for the user is not found
if (results.items.length === 0) {
// create an item
const toInsert = {
"_id": userId,
"email": userEmail
};
// add the item to the collection
wixData.insert("Members", toInsert)
.catch( (err) => {
console.log(err);
} );
}
// update buttons accordingly
$w("#loginbutton").label = "Logout";
$w("#membersareaonlystrip").expand();
$w("#whitegapforfooter").hide();
} )
.catch( (err) => {
console.log(err);
} );
}
}
export function profilebutton_onclick(event) {
wixLocation.to(`/Members/${wixUsers.currentUser.id}`);
}
export function entermembersbutton_onclick(event) {
wixLocation.to(`/members-area`);
}
export function myaccountbutton_onclick(event) {
wixLocation.to(`/account/my-account`);
}
export function websiteupdatebutton_onclick(event) {
wixLocation.to(`/website-update`);
}
If you are still stuck with it all, then Nayeli (Code Queen) has a great and simple tutorial on youtube for this tutorial from 2017 that you can view and go through yourself.
https://www.youtube.com/watch?v=Orl8GJNzG5s
If you open the show more info tab then you will be able to get her links for her website tutorial page and the code for it too.
Note that she has updated it in 2018 so that the tutorial will also check for duplicate user names too, which you can see in this newer youtube video from herself.
https://www.youtube.com/watch?v=yLCOqsVHhD0
@givemeawhisky It finally worked for me. I owe you a round of whisky for sure. Btw, are you a single malt (Glenfiddich) person or blended (Monkey Shoulder) type. Let me know if there’s a way to arrange for it 
Being a newbie to coding (especially with the syntax), I tried small pieces of code and executed it step by step to ensure I know what’s working for me, and what wasn’t.
I’m now able to create a single page with read/write input elements by inserting a dummy record with a dummy field triggered by $w(“#dataset1”).onReady(() function. This way, as soon as the page is viewed for the first time, the database creates one row of dummy data (where I chose to hide the dummy field on my form design). This way, the input elements can now access the record and provides the user an experience that is similar to entering data for the first time. Whereas in reality, it is actually updating it.
Of course, to ensure this code is effective only for the first refresh of the page, I use if($w(‘#dataset1’).getTotalCount() === 0) followed by insertion of record.
Glad you got it working, plus if you are paying then I’ll have both options 

I am trying to use the following code and it opens up the form to edit for the first time user but it’s running into error at the time of saving. Help please?
$w . onReady ( () => {
$w ( “#myDataset” ). onReady ( () => {
let count = $w ( “#myDataset” ). getTotalCount (); // 23
if ( count === 0 )
$w ( "#myDataset" ). add ()
. then ( ( ) => {
console . log ( "New item added" );
} )
. **catch** ( ( err ) => {
**let** errMsg = err ;
} );
} );
} );