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

fixed error with valdation message

parent 210ed922
Pipeline #1133 passed with stages
in 11 seconds
......@@ -20,7 +20,22 @@ function handleTextRadioClick() {
let value = document.getElementById("inputTextCharacters").value;
setCharacterLength(value);
}
isFormValid();
// show or hide validation messages
if (inputObj.textChoice === 'manual' && inputObj.text === '') {
//document.getElementById('textarea-validation').style.display = 'block';
} else {
document.getElementById('textarea-validation').style.display = 'none';
}
if (inputObj.textChoice === 'calculated' &&
(inputObj.numberOfCharacters === '' || inputObj.numberOfCharacters === 0)) {
//document.getElementById('textCharacters-validation').style.display = 'block';
} else {
document.getElementById('textCharacters-validation').style.display = 'none';
}
toggleElement('character-calculation-wrapper');
toggleElement('manual-character-input');
}
......@@ -66,7 +81,11 @@ function handleCharacterInputChange() {
// function setCharacterLength: sets number of characters to property numberOfCharacters on inputObj
function setCharacterLength(characters) {
inputObj.numberOfCharacters = parseInt(characters);
if (characters === '') {
inputObj.numberOfCharacters = 0;
} else {
inputObj.numberOfCharacters = parseInt(characters);
}
}
......@@ -83,7 +102,7 @@ function isFormValid() {
}
if (inputObj.textChoice === 'calculated' &&
(inputObj.textLenumberOfCharactersngth === '' || inputObj.numberOfCharacters === 0)) {
(inputObj.numberOfCharacters === '' || inputObj.numberOfCharacters === 0)) {
invalidFields++;
document.getElementById('textCharacters-validation').style.display = 'block';
......
Supports Markdown
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