I am asking users to tag books with particular values (called from a tag database and populated into a checkbox dropdown), and I want these values to populate two fields in my dataset; both the tags value, and a reference field.
I know many users have requested user input to connect to a reference field, and that it’s not build yet but can be achieved with code.
As you see, I have the user tag each book, which then populates into, for example, the ’ ‘bookSubject’ field. However, I want this information to also auto-populate into the ‘bookSubjectRef’ field. In the code below, I am unable to set the value:
export function submitFormButton_click(event) {
//Add your code for this event here:
let inputArray = ;
for ( let i = 1; i <= 3; i++) {
let inputData = {
title: $w(‘#bookInput’ + i).value,
bookStyle: $w(‘#bookStyle’ + i).value,
bookSubject: $w(‘#bookSubject’ + i).value,
bookSubjectRef: $w(‘#bookSubject’ + i).value,
bookGeo: $w(‘#bookGeo’ + i).value,
bookCharacter: $w(‘#bookChar’ + i).value,
bookTime: $w(‘#bookTime’ + i).value,
bookForm: $w(‘#bookForm’ + i).value,
bookCountry: $w(‘#country’ + i).value,
};
inputArray.push(inputData);
}
console.log(inputArray);
let collection = ‘bookInfo’;
wixData.bulkInsert(collection, inputArray)
.then( (results) => {
let item = results; //see item below
console.log(item);
} )
. catch ( (err) => {
let errorMsg = err;
} );
}
Any help is much appreciated!