Add form validation to KontoTable and KreditorTable components. Disable save button when form is invalid. Clean up console logs in TextHeaderWithFilter and dataUtils.
This commit is contained in:
@@ -98,6 +98,12 @@ class KontoTable extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
isFormValid = () => {
|
||||
const { formData } = this.state;
|
||||
return formData.konto.trim() !== '' &&
|
||||
formData.name.trim() !== '';
|
||||
};
|
||||
|
||||
handleSave = async () => {
|
||||
const { editingKonto, formData } = this.state;
|
||||
|
||||
@@ -257,7 +263,11 @@ class KontoTable extends Component {
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={this.handleCloseDialog}>Abbrechen</Button>
|
||||
<Button onClick={this.handleSave} variant="contained">
|
||||
<Button
|
||||
onClick={this.handleSave}
|
||||
variant="contained"
|
||||
disabled={!this.isFormValid()}
|
||||
>
|
||||
Speichern
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
||||
Reference in New Issue
Block a user