Hello, I have a form for my members. I want to save data from this form in a database called UserInfo. To know which member has completed the form, I am taking the nickname info from PrivateMembersData and it is working fine. Then I want to store all of the datas below in an other collection. However my code doesn't save any info from this form. I need help!!
import wixUsers from 'wix-users'; import wixData from 'wix-data'; $w.onReady(function () { wixData.query("Members/PrivateMembersData") .eq("_id", wixUsers.currentUser.id) .find() .then( (results) => { $w('#input6').value = results.items[0].nickname; }); }); export function Submit_click(event, $w) { $w('#dataset1').setFieldValue('nickname', $w('#input6').value); $w('#dataset1').setFieldValue('cinsiyet', $w('#dropdown1').value); $w('#dataset1').setFieldValue('yas', $w('#input4').value); $w('#dataset1').setFieldValue('kilo', $w('#input5').value); }
Thanks for your reply however I couldn't understand how to use it. I have tried the code below but it's not working.
import wixUsers from 'wix-users'; import wixData from 'wix-data'; // For full API documentation, including code examples, visit http://wix.to/94BuAAs $w.onReady(function () { wixData.query("Members/PrivateMembersData") .eq("_id", wixUsers.currentUser.id) .find() .then( (results) => { $w('#input6').value = results.items[0].nickname; }); }); export function Submit_click(event, $w) { $w('#dataset1').setFieldValue('cinsiyet', $w('#dropdown1').value); $w('#dataset1').setFieldValue('yas', $w('#input4').value); $w('#dataset1').setFieldValue('kilo', $w('#input5').value); } $w('#dataset1').save('nickname', $w('#input6').value); $w('#dataset1').save('cinsiyet', $w('#dropdown1').value); $w('#dataset1').save('yas', $w('#input4').value); $w('#dataset1').save('kilo', $w('#input5').value);
It was in the previous reply!
https://www.wix.com/corvid/forum/community-discussion/i-need-to-collect-more-information-from-site-members
Have a look at the setField Value or setFieldValues reference in Wix API reference.https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#setFieldValue https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#setFieldValues
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#save
$w("#myDataset").save();