Accessing the DOM object in client script

GnaneshP
Tera Contributor

I'm trying to get the text content from a HTML field (the content will be dynamic) and then display the value in another field (say 'description'). The client script I tried is not working as expected. The ID which is mentioned within the getElement() is for 'div' tag. For simple actions like button.click() is working but not when it comes to retrieving the text content.

 

Below is the code which I'm trying

 

var summaryText = g_form.getElement('gen-summaryText');
var strSummary = String.valueOf(summaryText);
alert(strSummary);
                
if (strSummary !== null) {
         g_form.setValue('description', strSummary);
} else {
         g_form.setValue('description', '');
}

 


Output:

 

function String() { [native code] }

 

Can anyone please pour your suggestions?

5 REPLIES 5

GnaneshP
Tera Contributor

Thanks @Marcos Kassak@jusfory1 for your suggestions, it is Now Assist for case summary.. so before the text is generated the div remains empty and once generated it is stored in another div. My bad with the ID name..
Before

GnaneshP_0-1730298984624.png


After

GnaneshP_1-1730299423278.png