I use repeater and connect to database.
The repeater setting mode read & write.
If I put the button in the repeater , it work.
But put outside repeater, it dosen't work.
Is there the way only use 1 button change the database?
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
Ok, now your setup is clear....
1) 1x-DATABASE
2) 1x-DATASET (non-dynamic)
3) 1x-REPEATER
4) 1x-Submit-Button (OUTSIDE-REPEATER --> $w)
5) 6x Inputfields (INSIDE-REPEATER --> $item)
DATABASE + REPEATER ---> connected to DATASET
CODE: Something like this one..... (replace all needed IDs of all your elements)
let REPEATER = "#repeater1" let DATASET = "#???????????????????????????????????????????" $w.onReady(()=> {console.log("Page is ---> READY...") $w(REPEATER).onReady(($item, itemData, index)=> { $w('#button268').onClick(()=>{console.log("EXTERN-Button-Clicked!!!") $w(DATASET).setFieldValues( { "url": $item('#aaaaaaaaaa').value, "number": $item('#bbbbbbbbbb').value, "xxxxxx": $item('#cccccccccc').value, "yyyyyy": $item('#dddddddddd').value, "zzzzzz": $item('#eeeeeeeeee').value, "wwwwww": $item('#ffffffffff').value, }); $w(DATASET).save(); console.log("Save-process running...") }); $w(DATASET).onAfterSave(()=> {console.log("After save running...");}); }); });
But i fear this one also won't work like you expect it. Your Submit-Button must be INSIDE-REPEATER, too (inside-Repeater-Container), otherwise your REPEATER won't be able to recognize which of your items has been selected!
After you find out that my fears have come true, do the following changes....
1) Put your Submit-Button into REPEATER.
2) Change the following CODE-LINE....
..from this...
$w('#button268').onClick(()=>{console.log("EXTERN-Button-Clicked!!!")
...to this.....
$item('#button268').onClick(()=>{console.log("INTERN-Button-Clicked!!!")
BUT WAIT !!!! --> "#dynamicDataset" ??? What ? 😮
So what is it now??? 🤣🤣🤣🤣🤣🤣🤣🤣🤣 DYNAMIC <--- or ---> NON-DYNAMIC