Convert textarea to htmlArea

sami_siddiqui
Kilo Explorer

Hi,

Is there any possibility to convert a textarea in UI Page to htmlArea?If yes then please share how to achieve this.

Sami.

1 ACCEPTED SOLUTION

Sami,



I was able to get this to work in a demo instance.   First, nicEdit needs to be saved as a "UI Script", not a "Script Include".   Then, the client script portion should just be calling the bkLib function and does not need to be in a separate function.   Just use:   bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });


View solution in original post

4 REPLIES 4

sami_siddiqui
Kilo Explorer

I tried using NicEdit - WYSIWYG Content Editor, Inline Rich Text Application.


Below is my UI Page code



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


<script>


<html>


<head>


  <title>Demo 1 : Convert All Textareas</title>


</head>


<body>


<div id="menu"></div>


<div id="intro">


By calling the nicEditors.allTextareas() function the below example replaces all 3 textareas on the page with nicEditors. NicEditors will match the size of the editor window with the size of the textarea it replaced.


</div>


<br />


<div id="sample">


<h4>First Textarea</h4>


<textarea name="area1" cols="40"></textarea>


<h4>Second Textarea</h4>


<textarea name="area2" style="width: 100%;">


  Some Initial Content was in this textarea


</textarea>


</div>


</body>


</html>


</j:jelly>



I am calling nicEditors.allTextAreas() function in script include through client script but textarea are not converted to htmlarea.Below is the client script in ui page.



addLoadEvent(loadMe);


function loadMe(){


//alert('Loading');


bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });



Can any one please help me to trace where is the mistake?



Sami.




}


Sami,



I was able to get this to work in a demo instance.   First, nicEdit needs to be saved as a "UI Script", not a "Script Include".   Then, the client script portion should just be calling the bkLib function and does not need to be in a separate function.   Just use:   bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });


Thanks John,It is working with UI Script but it's not showing the toolbar icons.



nicEditorIcons.png



I attached nicEditorIcons.gif to UI Script and then updated the iconsPath : '../nicEditorIcons.gif' in the script with the sys_id of the attached gif.Also I tried uploading the image and passed the complete url https://sandbox.service-now.com/nicEditorIcons.gifx but it didn't worked.


Any further help in this regard will be highly appreciated.



Thanks,


Sami.


John,


It is working fine now,I just removed nicEditorIcons.gif from UI Script and then passed the image url in the script.


nicEditorIcons.png


Many thanks for your help.



Sami.