Question

4
Replies
4187
Views
Close popover
Ravi Kiran (RaviK518)
MSoft

MSoft
IN
RaviK518 Member since 2016 40 posts
MSoft
Posted: November 17, 2017
Last activity: November 21, 2017
Closed
Solved

How to use JavaScript code for doing Validations inside section

I have a TextInput whose max length is of 20.
In case The User Types 15 letters and i need to make the text field color to red

I found out this code

document.getElementById("pyTextArea1").addEventListener("keyup", function(){
    var element = document.getElementById("pyTextArea1");
    var charMaxValue = element.getAttribute("maxLength");
    var tempValue = element.value.replace(/\r/g,"");
    
    console.log("MaxValue" + charMaxValue + " tempValue" + tempValue);
    if((charMaxValue - tempValue.length) < 5){
    $('.textAreaCharCounter').css("color","red");

    }
   else{
    $('.textAreaCharCounter').css("color","grey");
    }
});

Could you please let me know , what must be given in place of pyTextArea1?
Is this the Property name ?

Could you please tell me how can i use this code inside my screen ??

What are the steps need to be followed ? (Assuming my Harness is Perform) and my section name is CaptureDetails_Sec ??

***Updated by moderator: Lochan to update Categories***

Data Integration Java and Activities Case Management User Experience
Moderation Team has archived post,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.