Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
srikanth gunday
using two ->liferay-ui:input-editor FCKEditor
January 27, 2011 12:03 PM
Answer

srikanth gunday

Rank: New Member

Posts: 4

Join Date: May 22, 2009

Recent Posts

Hi, I am trying to use two FCKEditor in same jsp page,

<liferay-ui:input-editor editorImpl="<%= EDITOR_WYSIWYG_MESSAGE_KEY %>" initMethod="getCurrentText" width="100%" />


<liferay-ui:input-editor name ='messageEditor' editorImpl="<%= EDITOR_WYSIWYG_MESSAGE_KEY %>" initMethod="getCurrentText" width="100%" />

when I am reading the text I am using the below function

<script type="text/javascript">
function initEditor() {
return "<%= UnicodeFormatter.toString( registrationPrompt ) %>";
}

function getCurrentText(){
return "<%= UnicodeFormatter.toString(registrationMessage) %>"
}
</script>

and when I wnat to save,"due to default" I am getting same text for both
"editor.getHTML()", can any one help me to get the content for both, Instead of using editor.getHTML(), can I give some name in ->liferay-ui:input-editor name ='messageEditor'
and retrive that second editor.

Thanks
Srikanth
Jay Patel
RE: using two ->liferay-ui:input-editor FCKEditor
January 31, 2011 2:56 AM
Answer

Jay Patel

Rank: Regular Member

Posts: 116

Join Date: February 23, 2010

Recent Posts

Hi Srikanth,

Definitely, you can use "name" attribute of <liferay-ui:input-editor/> tag.

While adding FCKEditor first time, you may use default one like follows:

<liferay-ui:input-editor />

And then HTML content value for this editor you may retrieve using "editor.getHTML()".

Whereas for second editor, you may use code as follows:

<liferay-ui:input-editor name="messageEditor" />

And then HTML content value for this editor you may retrieve using "messageEditor.getHTML()".

Have fun...emoticon
Jitendra Rajput
RE: using two ->liferay-ui:input-editor FCKEditor
January 23, 2012 5:32 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 824

Join Date: January 7, 2011

Recent Posts

Jay ,

How to right separate init method for multiple FCK Editor ?
I want to initialize FCK editor with predefine values ..But as i have only one initMethod() both of the FCK editor getting loaded with same value..
Vaibhav Mittal
RE: using two ->liferay-ui:input-editor FCKEditor
June 19, 2013 3:02 AM
Answer

Vaibhav Mittal

Rank: Junior Member

Posts: 54

Join Date: July 16, 2012

Recent Posts

Hi Jitender,

Can you tell me how to load CkEditor with last saved values. Attribute values is not working in below tag :
<liferay-ui:input-editor name="preferences--editor--" width="100%" value="<%= editor %>" />

Error I am getting : Attribute value invalid for tag input-editor according to TLD
If there is any other attribute for this ?
Jitendra Rajput
RE: using two ->liferay-ui:input-editor FCKEditor
June 28, 2013 2:05 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 824

Join Date: January 7, 2011

Recent Posts

You need to define init method for this . Get you saved data and pass it to fcKEditor in following method.

1function <portlet:namespace />initEditor()
2{
3    var fckValue = document.getElementById("description").value;
4    return fckValue ;
5}
Vaibhav Mittal
RE: using two ->liferay-ui:input-editor FCKEditor
July 1, 2013 8:51 AM
Answer

Vaibhav Mittal

Rank: Junior Member

Posts: 54

Join Date: July 16, 2012

Recent Posts

Jitendra Rajput:
Jay ,

How to right separate init method for multiple FCK Editor ?
I want to initialize FCK editor with predefine values ..But as i have only one initMethod() both of the FCK editor getting loaded with same value..


If you are still looking for the solution, I tried below code and it worked :
<liferay-ui:input-editor name="preferences--firstEditor--" initMethod="getFirstEditor"/>
<liferay-ui:input-editor name="preferences--secondEditor--" initMethod="getSecondEditor"/>

<script type="text/javascript">
function <portlet:namespace />getFirstEditor() {
return "<%= UnicodeFormatter.toString(preferences.getValue("firstEditor", "default text 1")) %>";
}

function <portlet:namespace />getSecondEditor() {
return "<%= UnicodeFormatter.toString(preferences.getValue("secondEditor", "default text 2")) %>";
}
</script>
Vaibhav Mittal
RE: using two ->liferay-ui:input-editor FCKEditor
July 1, 2013 9:00 AM
Answer

Vaibhav Mittal

Rank: Junior Member

Posts: 54

Join Date: July 16, 2012

Recent Posts

Jitendra Rajput:
You need to define init method for this . Get you saved data and pass it to fcKEditor in following method.

1function <portlet:namespace />initEditor()
2{
3    var fckValue = document.getElementById("description").value;
4    return fckValue ;
5}


Thnxx for your replly. Through above I got the concept of initEditor and but I used preferences(which you discovered) instead of id :
<liferay-ui:input-editor name="preferences--abcEditor--" initMethod="getCurrentText" />

<script type="text/javascript">
function <portlet:namespace />getCurrentText() {
return "<%= UnicodeFormatter.toString(preferences.getValue("abcEditor", "default text")) %>";
}
</script>