Adding items in repeater

Hi everyone, I just want to add some information in my website using inputs and repeater. I took some input fields and repeater. Fetch data from input to repeater. For this I refer some YouTube links.
https://www.youtube.com/watch?v=H5SrF6Bjoos&list=PL0y_aclKYoYjJFS4KscWqs0K6Yus6BJND&index=5
https://www.youtube.com/watch?v=dZfduwbN0vw&list=PL0y_aclKYoYjJFS4KscWqs0K6Yus6BJND&index=6
Adding and removing items are done in repeater but when I load site or close the tab then the filled data will not display again.
I want to save this data in that repeater for permanently.
Please suggest me any solution.
Thanks in advance.

Repeater can’t save your input data dynamically. Please save your input data to some collection(wix’s database) via velo code or dataset connection. That way you can reload new added data from collection to your repeaters even if when you reload the pages.

Thanks for comment but I want to show this data on page. Actually I want, https://www.makemytrip.com/my-profile/ like this functionality. I want to add family members info in profile and save it. But this is not possible in wix, so I want try something with velo. Please give any suggestion.
Thanks

velo beginner?:thinking:
Please check this Velo API Page.:laughing:

https://www.wix.com/velo/reference/wix-data/save
https://www.wix.com/velo/reference/wix-data/query
https://www.wix.com/velo/reference/$w/repeater/data

Yes beginer. Can it is possible that I want?

Sure. First you should make a collection(database that can store your family’s data permanently) from your wix Editor. and set property in your collection something like “name”, “age”, “hobby”…etc.

Also, I think the code you should enter will be roughly like this.

import wixData from 'wix-data';

$w.onReady(function () {

$w("#familyProfileRepeater").onItemReady( ($item, itemData, index) => {
    $item("#name").text = itemData.name;
    $item("#age").text = itemData.age;
    $item("#hobby").src = itemData.hobby;
  } );

  wixData.query("familyProfileCollection'sName")
    .find()
    .then( (results) => {
      $w("#familyProfileRepeater").data = results.items;
    } );


$w("#addButton").onClick(()=>{ // click event
 
let toSave = {
  "name": $w("#familyNameInput").value,
  "age": $w("#familyAgeInput").value,
  "hobby": $w("#familyHobbyInput").value
};

//save your family's profile data to collection.
wixData.save("familyProfileCollection'sName", toSave)
  .then((results) => {
    console.log(results); //saved item results
 })
  .catch((err) => {
    console.log(err);
 });
 
});

});

Thank you so much. But this data can be collected all users info in one collection. How can I seperate out for different users?
Means If I am one user and I add 5 members info in that collection. And then there are many users they can add family members info. Then how this data will be seperate out?

Ok.

First, you should add wix app member area. (Wix page can get login System)

Then, your family each member can get memberId from Wix. You should use this memberId.


//https://www.wix.com/velo/reference/wix-members
//https://www.wix.com/velo/reference/wix-members-backend

const member = await getMember(); // ↑ please check!!
const memberId = member._id;

// save with memberId
let toSave ={
"memberId": memberId
"name":$w("#familyNameInput").value,
"age":$w("#familyAgeInput").value,
"hobby":$w("#familyHobbyInput").value 
};
wixData.query("familyProfileCollection'sName")
.eq("memberId",memberId) // query with memberId
.find()
.then((results)=>{
    $w("#familyProfileRepeater").data = results.items;
});

Ok I’ll check it and let you know tomorrow.
Thanks