I am trying to create a form that allows users to rate a restaurant (which is another section) by creating a "userRatings" section entry. userRatings has three fields: a dropdown field called ratings, a users field called user, and an entry field called restaurants. The form is on the entry page for a restaurant. Here is what my form looks like now:

<form method="post" accept-charset="UTF-8">
  {{ getCsrfInput() }}
  <input type="hidden" name="action" value="entries/saveEntry">
  <input type="hidden" name="redirect" value="viewentry/{slug}">
  <input type="hidden" name="sectionId" value="userRatings">
  <input type="hidden" name="sectionId" value="9">

  <input type="text" id="user" name="ratings" value="{{currentUser}}" style="display:none;" readonly>

  <input type="text" id="restaurant" name="restaurant" value="{{entry}}" style="display:none;" readonly>

  <label for="ratings">Rate This Restaurant</label>
  <select id="ratings" name="ratings">
      {% for option in entry.ratings.options %}
        <option value="{{ option.value }}">{{option.label}}</option>
      {% endfor %}

<input class="button" type="submit" value="Rate">

The select list successfully pulls in the options from the "ratings" dropdown field, and I have two text boxes that are recording the current user and the restaurant that the user is trying to rate.

Right now, when the form submits, it goes back to the same page with no errors, but nothing is saved on the back-end. Any help or suggestions would be greatly appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.