I'm doing a master child relationship for data entry. Basically one person can have many licenses.
The only way i could find to actually set the reference in the child record when creating that record, was to save it to the collection via its dataset and then use the insertReference function https://www.wix.com/code/reference/wix-data.html#insertReferencefunction to insert the _id of the record that i wanted associated as the parent.....however.....
I have discovered that running this function only works on multi- reference fields (many-many style relationship). If i run the function against a single reference field it errors out.
Is this a required item or a bug?
I did notice that you can pass an array of items into that field, but I believe it should only enforce the "multi-reference" field rule if an array is being passed (multiple references to that child record)
The issue is on the lightbox DriversLicense
The code in question is in the function buttonSaveClose_click
here's the editor link for the site https://editor.wix.com/html/editor/web/renderer/edit/a4e231dd-d07a-49d5-ac5f-3b2d2f821df1?metaSiteId=7a12991b-6802-4baa-bc84-3fd4c51da5e5&editorSessionId=fd80c2be-648c-4de1-b36f-2e0d3a51329e&referralInfo=my-account
....still very much a work in progress and my first site ever so be gentle!! lol