Commit 210ed922 authored by Ratnadeep Rajendra Kharade's avatar Ratnadeep Rajendra Kharade
Browse files

added validation for minimum number of characters

parent 10419a27
Pipeline #1132 passed with stages
in 11 seconds
......@@ -12,6 +12,15 @@ let inputObj = {
function handleTextRadioClick() {
let textChoice = document.querySelector('input[name="text-input-option"]:checked').value;
inputObj.textChoice = textChoice;
if (textChoice === 'manual') {
let value = removeSpecialCharacters(inputObj.text);
let characters = value.length;
setCharacterLength(characters);
} else {
let value = document.getElementById("inputTextCharacters").value;
setCharacterLength(value);
}
isFormValid();
toggleElement('character-calculation-wrapper');
toggleElement('manual-character-input');
}
......@@ -96,6 +105,13 @@ function isFormValid() {
document.getElementById('category-validation').style.display = 'none';
}
if ((inputObj.numberOfCharacters < 100 && (inputObj.schoolLevel === '1' || inputObj.schoolLevel === '2'))) {
invalidFields++;
document.getElementById('min-count-validation').style.display = 'block';
} else {
document.getElementById('min-count-validation').style.display = 'none';
}
return invalidFields < 1
}
......@@ -238,7 +254,7 @@ function calculateReadingTime() {
}
}
// function getFormatted time
// function getFormattedTime
// accepts seconds value and returns in hh:mm:ss format
function getFormattedTime(totalSeconds) {
let hours = Math.floor(totalSeconds / 3600);
......
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