0

I'm currently trying to make a input field with a 5 star review system. Basically user inputs 1-5 as a Rating and it's saved to the database. Right now when I insert the number it gives me this error: "INTERNAL_SERVER_ERROR: Variable "$issue" got invalid value "5" at "issue.rating"; Int cannot represent non-integer value: "5""

Here's the code for the values:

    e.preventDefault();
    const form = document.forms.issueAdd;
    const issue = {
      title: form.title.value,
      review: form.review.value,
      rating: form.rating.value,
      author: form.author.value,
      due: new Date(new Date().getTime() + 1000*60*60*24*10),
    }
    this.props.createIssue(issue);
    form.title.value = "";
    form.review.value = "";
    form.rating.value = "";
    form.author.value = "";
  }```

I'm wondering how to convert the form.rating.value into a int so it won't give the error. 

1 Answers1

0

replace the "" with zero.

form.rating.value = 0;
sonEtLumiere
  • 4,461
  • 3
  • 8
  • 35