Input value to a reference field

Hi there,

You will need to write a bit of code to handle this scenario, basic idea being:

  1. Adding an appropriate event handler to the dropdown (or form submit button if the dropdown is a part of a form).
  2. Getting currently selected value.
  3. Inserting a reference to the selected membership into “membership” field for a certain member.

Here is a rough example of how it may look like:

import wixData from 'wix-data';

$w.onReady(function () {
  $w('#dropdown4').onChange(function(e) {
    const dropdown = e.target;
    const membershipId = dropdown.options[dropdown.selectedIndex].value;
    wixData.update('members', { _id: memberId, membership: membershipId })
      .catch(err => {
        let errorMsg = err;
      });
  })
});

This example assumes that each item of dropdown looks like this:

{label: 'Some Membership', value: membershipId}

You can find more info about working with data api here: