My Custom form has 2 Buttons: Save and Cancel. The Cancel works fine, but the Save does nothing. I get no one error. In RrlForm.tsx has an method - updateItem, this read the new inputs from imputfields and updates in the list the item. (some code below)
<DefaultButton onClick={() => this.updateListItem() }> Save</DefaultButton>
public updateListItem = (): any => {
const { selectedOption } = this.state;
const { geschlecht } = this.state;
const { title } = this.state;
const { firstname } = this.state;
const { lastname } = this.state;
const { phone1 } = this.state;
const { phone2 } = this.state;
const { svnr } = this.state;
const { inquiry } = this.state;
const { isChecked } = this.state;
sp.web.lists.getByTitle('Listname')
.items.getById(68).update({
'Rubrik': selectedOption,
'Geschlecht': geschlecht,
'Title': title,
'Vorname': firstname,
'Nachname': lastname,
'Telefon1': phone1,
'Telefon2': phone2,
'SVNR': svnr,
'ZustaentigerId': { results: this.state.user },
'Anfrage': inquiry,
'Mail': isChecked,
'zusaetzlichId': { results: this.state.zusaetzlich },
})
.then(() => {
alert("Items are saved!");
this.cancel();
}
).catch((e: any) => console.error(e));
const url: any = new URL(window.location.href);
const targetURL = url.searchParams.get('Source') || ('https://xyz.sharepoint.com/teams/MyTestSite');
document.location.href = targetURL;
}
Any idea, why doesn't it work?