Different database depending on option selection in a form.

Hey Paule,

If you have 3 different databases and you wish to enter the information into any-one depending on the user input then you need to do something like this

//Suppose you have a dropdown which determines the database
 
var database; //define a global variant

export function dropdown2_change(event) {
 if($w("#dropdown2").value === 'Option A') {
        database = 'DatabaseOne';
    } else if($w("#dropdown2").value === 'Option B') {
        database = 'DatabaseTwo';
    } else if($w("#dropdown2").value === 'Option C') {
        database = 'DatabaseThree';
    }
}

function insertEmail() { //call this function whenver you need to submit a data
     let data = {
         'email': $w("#email").value //whatever your field keys are
     };
     wixData.insert(database, data);
}