diff --git a/src/components/modals/feedback/Feedback.jsx b/src/components/modals/feedback/Feedback.jsx index 8c31208c..310c140b 100644 --- a/src/components/modals/feedback/Feedback.jsx +++ b/src/components/modals/feedback/Feedback.jsx @@ -6,35 +6,51 @@ export default class FeedbackModal extends PureComponent { constructor() { super(); this.state = { - questionone: 5, - questionthree: 5, - questiontwoerror: '', - questionfourerror: '', + question_one: 5, + question_two: { + value: '', + error: '' + }, + question_three: 5, + question_four: { + value: '', + error: '' + }, formsubmit: '' }; this.language = window.language.modals.feedback; } - async submitForm () { - let questiontwoerror, questionfourerror; + async submitForm(e) { + e.preventDefault(); - if (document.getElementById('questiontwo').value.length <= 0) { - questiontwoerror = this.language.not_filled; + let question_two_error, question_four_error; + + if (this.state.question_two.value.length <= 0) { + question_two_error = this.language.not_filled; } - if (document.getElementById('questionfour').value.length <= 0) { - questionfourerror = this.language.not_filled; + if (this.state.question_four.value.length <= 0) { + question_four_error = this.language.not_filled; } - if (questiontwoerror || questionfourerror) { + if (question_two_error || question_four_error) { this.setState({ - questiontwoerror: questiontwoerror, - questionfourerror: questionfourerror + question_two: { + error: question_two_error + }, + question_four: { + error: question_four_error + } }); } else { this.setState({ - questiontwoerror: '', - questionfourerror: '' + question_two: { + error: '' + }, + question_four: { + error: '' + } }); await fetch(window.constants.FEEDBACK_FORM, { @@ -56,37 +72,35 @@ export default class FeedbackModal extends PureComponent {

{this.language.title}

× - <> +
- <> +


- this.setState({ questionone: e.target.value })}/> - - -

- <> + this.setState({ question_one: e.target.value })}/> + +
+
-