Hi,
I’m truly sorry for the delay. Firstly, note that the grey columns are created automatically when creating a dynamic page and based on the settings of it. You cannot edit it. Moreover, the images are a bit blurry so I was not quit sure what you were referring. Can you please send us the site URL so that I can have a look?
if i understand your question correct, you have a form ‘AJOUTS TITRES’ in which you want to add a new item but one of the input is a reference to the artist table?
so it should be a drop down of artists right?
in the collection in the db, although you see in the editor the title of the artists, what’s really being kept is the _id of the other collection.
So far, when I go through my add title page, it leaves the “Artist” field empty. Everything else fills up normally. So in the database, I have to manually enter the names of the artists
ok, i understand. as i wrote above, in the db collection editing you have in the editor there is a UI trick, you insert the artist name ‘Artiste’ because it is your collection primary field but it actually saves the ‘ID’ of the collection record in the db. this is why it will not work just like that in the form
please also think about spelling mistake and validations, in case the input artist does not appear in the db. please also keep in mind that currently you can also create artists in the collection with an identical name (different ID)
so in the form you need to create some kind of a search on the artist collection the user can choose from, keep the and then before submitting the form set the ID value in the artiste field of your Titres collection
run this code below in your page and see in preview console what you get:
import wixData from 'wix-data';
$w.onReady(async function () {
let artist = await wixData.get('Titres','59e91716-caf6-4249-b0cc-31bf6ac34c8a');
console.log(artist);
console.log(artist.artiste)
});
i am able to see your site’s code, running it this is what i get:
{“_id”:“59e91716-caf6-4249-b0cc-31bf6ac34c8a”,“_owner”:“51b05dc5-5c08-4a3e-9875-6fe08f218e63”,“_createdDate”:“2018-07-24T14:24:55.768Z”,“_updatedDate”:“2018-07-24T14:26:45.558Z”,“title”:“Medley (Live "La Dernière Danse" 2017)”,“inputArtist”:“Michel Sardou”,“artiste”:“e735c657-ad4c-423e-9741-b82f773fbc99”,“annee”:“2017”,“live”:“Live”,“languePrincipale”:“Français”}
e735c657-ad4c-423e-9741-b82f773fbc99
but my point is that the actual data you should save in the db is the ID, not the name. so when using a form with an artist name as a reference field, it should contain the ID of the referenced artist. this is why the current form is not working for you.
if you will add a console.log(firstItem) of the item you load from the db, you will see that this is the entire json object. you just need to thake the _id form this object to be put in the ‘Artiste’ field