I'm creating a form using Sails.js
. The form has multiple pages, and each time the user navigates to the next page, the data they've inputted to the form for the current page is submitted to a MySQL
database.
On one page of the form, there are two radio buttons, one with a value 'Yes' and one with a value of 'No'. The value of whichever button is checked is submitted to the database, to the 'author1Corresponding' column. From my understanding of radio buttons, if one is checked, the specified value, i.e. 'Yes' or 'No' should be submitted to the database. However, when either one is checked, author1Corresponding gets the value 'false'. If neither button is checked, author1Corresponding gets the value 'null'.
Here is my code in the html
form for the two buttons:
<label for="articleSubmission[author1Corresponding]">Is this Author the Corresponding Author?</label><br>
<input type="radio" class="radio" name="articleSubmission[author1Corresponding]" value="Yes"> Yes<br><br>
<input type="radio" class="radio" name="articleSubmission[author1Corresponding]" value="No"> No
The class radio
is just being used to style both buttons as having display: inline
.
Why isn't the defined value being submitted to the database, and how can I fix this?