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() { ...@@ -20,7 +20,22 @@ function handleTextRadioClick() {
let value = document.getElementById("inputTextCharacters").value; let value = document.getElementById("inputTextCharacters").value;
setCharacterLength(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('character-calculation-wrapper');
toggleElement('manual-character-input'); toggleElement('manual-character-input');
} }
...@@ -66,7 +81,11 @@ function handleCharacterInputChange() { ...@@ -66,7 +81,11 @@ function handleCharacterInputChange() {
// function setCharacterLength: sets number of characters to property numberOfCharacters on inputObj // function setCharacterLength: sets number of characters to property numberOfCharacters on inputObj
function setCharacterLength(characters) { function setCharacterLength(characters) {
inputObj.numberOfCharacters = parseInt(characters); if (characters === '') {
inputObj.numberOfCharacters = 0;
} else {
inputObj.numberOfCharacters = parseInt(characters);
}
} }
...@@ -83,7 +102,7 @@ function isFormValid() { ...@@ -83,7 +102,7 @@ function isFormValid() {
} }
if (inputObj.textChoice === 'calculated' && if (inputObj.textChoice === 'calculated' &&
(inputObj.textLenumberOfCharactersngth === '' || inputObj.numberOfCharacters === 0)) { (inputObj.numberOfCharacters === '' || inputObj.numberOfCharacters === 0)) {
invalidFields++; invalidFields++;
document.getElementById('textCharacters-validation').style.display = 'block'; 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