Skip to content

Commit

Permalink
Merge pull request #17 from AnthonyDeSantiago/newUser
Browse files Browse the repository at this point in the history
Changed some id's to match answer
  • Loading branch information
AnthonyDeSantiago authored Sep 24, 2023
2 parents d32987c + 1cceda1 commit b57355b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions public/new_user_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h2 id = "avatar_form">
<label for="security_question" class= "dropdown_list_SQ">
Security Questions
</label>
<select name ="questions" class = "question_select">
<select name ="questions" class = "question_select" id="question1_selected">
<option value="--Choose a question"></option>
<option value="What's the name of your Best Friend?">What's the name of your Best Friend?</option>
<option value="Where were you born?">Where were you born?</option>
Expand All @@ -89,11 +89,11 @@ <h2 id = "avatar_form">

<div class="form-control">
<!--<label for="question2">Enter Answer</label>-->
<input type="text" name="question1" id="question1" class="new_user_form_field" placeholder="Enter Answer">
<input type="text" name="answer1" id="answer1" class="new_user_form_field" placeholder="Enter Answer">
<small>Error Message</small>
</div>

<select name ="questions" class = "question_select">
<select name ="questions" class = "question_select" id="question2_selected">
<option value="--Choose a question"></option>
<option value="What's the name of your Best Friend?">What's the name of your Best Friend?</option>
<option value="Where were you born?">Where were you born?</option>
Expand All @@ -104,7 +104,7 @@ <h2 id = "avatar_form">

<div class="form-control">
<!--<label for="question2">Enter Answer</label>-->
<input type="text" name="question2" id="question2" class="new_user_form_field" placeholder="Enter Answer">
<input type="text" name="answer2" id="answer2" class="new_user_form_field" placeholder="Enter Answer">
<small>Error Message</small>
</div>

Expand Down
18 changes: 10 additions & 8 deletions public/sprout.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ document.getElementById("new_user_form").addEventListener("submit", async functi
const dateOfBirthElement = document.getElementById("dateofbirth");
const addressElement = document.getElementById("address");
const passwordElement = document.getElementById("password");
const question1Element = document.getElementById("question1");
const question2Element = document.getElementById("question2");
const answer1Element = document.getElementById("answer1");
const answer2Element = document.getElementById("answer2");

var userEmail = userEmailElement.value;
var firstName = firstNameElement.value;
var lastName = lastNameElement.value;
var address = addressElement.value;
var dateOfBirth = dateOfBirthElement.value;
var password = passwordElement.value;
var question1 = question1Element.value;
var question2 = question2Element.value;
var answer1 = answer1Element.value;
var answer2 = answer2Element.value;

var isValid = true;

Expand Down Expand Up @@ -163,14 +163,16 @@ document.getElementById("new_user_form").addEventListener("submit", async functi
isValid = false;
}

if (question1 == '') {
if (answer1 == '') {
var errorMessage = 'Please enter an answer.';
showError(question1Element, errorMessage);
showError(answer1Element, errorMessage);
isValid = false;
}

if (question2 == '') {
if (answer2 == '') {
var errorMessage = 'Please enter an answer';
showError(question2Element, errorMessage);
showError(answer2Element, errorMessage);
isValid = false;
}


Expand Down

0 comments on commit b57355b

Please sign in to comment.