Hi,
I have a FCKeditor in my webpage. When it gets focus I want to check if a condition is met. If not I want to display an alert and have the editor lose focus so that user cannot edit it. Only if condition is true can should the editor be edited. This is what I have:
function FCKeditor_OnComplete(editorInstance){
editorInstance.Events.AttachEvent( 'OnFocus',checkLanguageSelected) ;
}
// Alert if user starts typing in FCKeditor without selecting a language first
function checkLanguageSelected(editorInstance){
if($(".languageLabelSelected").length==0 && editorInstance.Name!="textEditor"){
alert("<cfoutput>#inputFieldTip#</cfoutput>")
editorInstance.EditorDocument.body.contentEditable = false;
}
else{
//restore editor status
editorInstance.EditorDocument.body.contentEditable = true;
}
}
the condition
$(".languageLabelSelected").length==0 && editorInstance.Name!="textEditor"
is specific to my application and not relevant to the question, it just returns true or false
It does not work, after the alert displays, the editor is editable. I would like the editor not to be editable.
Is there some method in the FCKEditor API that lets me do this?
Thanks
I have a FCKeditor in my webpage. When it gets focus I want to check if a condition is met. If not I want to display an alert and have the editor lose focus so that user cannot edit it. Only if condition is true can should the editor be edited. This is what I have:
function FCKeditor_OnComplete(editorInstance){
editorInstance.Events.AttachEvent( 'OnFocus',checkLanguageSelected) ;
}
// Alert if user starts typing in FCKeditor without selecting a language first
function checkLanguageSelected(editorInstance){
if($(".languageLabelSelected").length==0 && editorInstance.Name!="textEditor"){
alert("<cfoutput>#inputFieldTip#</cfoutput>")
editorInstance.EditorDocument.body.contentEditable = false;
}
else{
//restore editor status
editorInstance.EditorDocument.body.contentEditable = true;
}
}
the condition
$(".languageLabelSelected").length==0 && editorInstance.Name!="textEditor"
is specific to my application and not relevant to the question, it just returns true or false
It does not work, after the alert displays, the editor is editable. I would like the editor not to be editable.
Is there some method in the FCKEditor API that lets me do this?
Thanks