Commit f3f9462c authored by Ratnadeep Rajendra Kharade's avatar Ratnadeep Rajendra Kharade
Browse files

allowed calculation once the form is valid

parent c95ca4ef
Pipeline #1076 passed with stages
in 3 seconds
...@@ -43,12 +43,13 @@ function setCharacterLength(characters) { ...@@ -43,12 +43,13 @@ function setCharacterLength(characters) {
} }
function calculateReadingTime() { function calculateReadingTime() {
let isFormValid = validateForm(); if (isFormValid()) {
let x = document.getElementById('calculate-time-element'); let x = document.getElementById('calculate-time-element');
x.style.display = "block"; x.style.display = "block";
}
} }
function validateForm() { function isFormValid() {
let invalidFields = 0; let invalidFields = 0;
if (inputObj.textChoice === 'manual' && inputObj.text === '') { if (inputObj.textChoice === 'manual' && inputObj.text === '') {
invalidFields++; invalidFields++;
...@@ -77,7 +78,9 @@ function validateForm() { ...@@ -77,7 +78,9 @@ function validateForm() {
} else { } else {
document.getElementById('readerCategory-validation').style.display = 'none'; document.getElementById('readerCategory-validation').style.display = 'none';
} }
return invalidFields < 1
} }
function showFeedbackForm() { function showFeedbackForm() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment