Form field auto fill and remember input content

Below is my form which works perfectly fine. I do have a question which I can’t find out; I want it to a: auto fill for the user and b: it would be great for certain fields to remember its content after submitting the form for repeated users.

How can I accomplish this? Thanks for your feedback!

import { sendEmail , sendEmailWithRecipient } from ‘backend/email’ ;

$w . onReady ( function () {
$w ( “#dataset1” ). onAfterSave ( sendFormData );
});

function sendFormData ( ) {
const subject = Nieuwe opdracht geplaatst door ${ $w ( "#input33" ). value };
const body = `Samenvatting van aangeboden opdracht via Talent Trade

\rOpdracht titel:  ${ $w ( "#input27" ). value } 
\rFunctie titel:  ${ $w ( "#input28" ). value } 
\rOmschrijving:  ${ $w ( "#textBox3" ). value } 
\rExtra info:  ${ $w ( "#textBox4" ). value } 
\rVaardigheden:  ${ $w ( "#checkboxGroup2" ). value } 
\rStartdatum:  ${ $w ( "#datePicker3" ). value } 
\rEinddatum:  ${ $w ( "#datePicker4" ). value } 
\rStarttijd:  ${ $w ( "#timePicker3" ). value } 
\rEindtijd:  ${ $w ( "#timePicker4" ). value } 
\rPauze:  ${ $w ( "#dropdown3" ). value } 
\rAantal ZZP'ers:  ${ $w ( "#input29" ). value } 
\rUurtarief excl btw en bemiddelingskosten:  ${ $w ( "#input30" ). value } 
\rWerkadres:  ${ $w ( "#input36" ). value } 
\rContactpersoon:  ${ $w ( "#input31" ). value } 
\rTelefoon:  ${ $w ( "#input32" ). value } 
\rBedrijfsnaam:  ${ $w ( "#input33" ). value } 
\rE-mail:  ${ $w ( "#input34" ). value } 

Voor wijzigingen of annuleren (24u van tevoren kosteloos wanneer de opdracht al is geaccepteerd) stuur je een reply op deze mail` ; 

const recipient = $w ( “#input34” ). value ;

sendEmailWithRecipient ( subject , body , recipient )
. then ( response => console . log ( response ));

sendEmail ( subject , body )
. then ( response => console . log ( response ));
}

You will need something into this direction…

import {sendEmail, sendEmailWithRecipient} from 'backend/email';
import {local} from 'wix-storage';

let dbField = [], fieldValue = []; 

$w.onReady(function () {let data = [];
    let memItems = local.getItem("memory"); console.log("MEMORY: ", savedData);

    //---MEMORY-CONTROLLER.....
    let toBeMemorized =  ["opdrachtTitle", "eMail"]; //<--- put in here, which data to be memorized!
    //----------------------------------------------------------------------
    const subject =     `Nieuwe opdracht geplaatst door ${$w("#input33").value}`;
    //-----------------------------------------------------------------------
    const recipient =   $w("#input34").value;    
    //-----------------------------------------------------------------------
    dbField[0] = "opdrachtTitle";       fieldValue[0] = $w("#input27").value;
    dbField[1] = "functieTitle";        fieldValue[1] = $w("#input28").value;
    dbField[2] = "omschrijving";        fieldValue[2] = $w("#textBox3").value;
    dbField[3] = "eMail";               fieldValue[3] = $w("#input34").value;
    //-----------------------------------------------------------------------    
    const body = `Samenvatting van aangeboden opdracht via Talent Trade
    \rOpdracht titel:${dbField[0]}
    \rFunctie titel:${dbField[1]}
    \rOmschrijving:${dbField[2]}
    \rE-mail:${dbField[3]}    
    Voor wijzigingen of annuleren (24u van tevoren kosteloos wanneer de opdracht al is geaccepteerd) stuur je een reply op deze mail`;
    //-----------------------------------------------------------------------
    
    for (let a = 0; a < dbField.length; a++) {
        //data[dbField[a]] = fieldValue[a];

        for (let b = 0; b < toBeMemorized.length; b++) {
            //---MEMORY-FUNCTION for some fields...
            if (dbField[a] === toBeMemorized[b]) {
                data.push({[dbField[a]]: fieldValue[0]})
            }
            if(a===dbField.length-1) {
                local.setItem("memory", JSON.stringify(data));
            }
        }        
    }   
    //-----------------------------------------------------------------------
    $w("#dataset1").onAfterSave(()=>{sendFormData(subject, body, recipient)});
    //-----------------------------------------------------------------------
   
});

function sendFormData(subject, body, recipient) {     
    sendEmailWithRecipient(subject, body, recipient).then(response => console.log(response)); 
    sendEmail(subject, body).then(response => console.log(response));
}

You will have to expand and optimize the shown code eventually. Give it a try.