Buttons are not working in form

Hy.

I added 2 buttons to my edit form.

When you click, these should set the value in a drop-down list and then save and close the form.

When I click on one of the buttons nothing happens.

What's wrong with the code?

Regards
Daniel

fd.spRendered(function() {
    // Button "FinanzGenhmigt" klickt → Wert setzen und speichern
    fd.control('FinanzGenhmigt').click = function() {
        fd.field('InvestApprovalFinance').value = 'genehmigt';
        fd.save().then(function() {
            fd.close();
        });
    };

    // Button "FInanzAbgelehnt" klickt → Wert setzen und speichern
    fd.control('FInanzAbgelehnt').click = function() {
        fd.field('InvestApprovalFinance').value = 'abgelehnt';
        fd.save().then(function() {
            fd.close();
        });
    };
});

Dear @Pfeilomatic,
Unfortunately, the button click event is written through a string, like so:

fd.spRendered(() => {
    fd.control('FinanzGenhmigt').onclick = 
        `
            fd.field('InvestApprovalFinance').value = 'genehmigt';
            fd.save().then(function() {
                fd.close();
            });
        `;
});