Question

4
Replies
4003
Views
RaviK518 Member since 2016 40 posts
MSoft
Posted: 2 years ago
Last activity: 2 years 10 months ago
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 Interface
Moderation Team has archived post
Share this page LinkedIn