CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Fixing JavaScript Error for FCKEditor When Hiding Form

Print topic Send  topic

Author Message
DonP
Posted: 04/30/2008, 12:41 PM

When a record that uses the FCKeditor is hidden, a JavaScript error
occurs. To fix the problem, you can hide or load the FCKeditor
dynamically too.

To do so, create a text file called fckinclude.js and save it in a
folder that is accessible from the site. I put it in a folder under the
root, called misc:

window.onload = function() {
var TextBoxName_FCK = new FCKeditor('TextBoxName');
TextBoxName_FCK.BasePath = "/fckeditor/";
TextBoxName_FCK.ReplaceTextarea();
}

If you are using a custom configuration file for the editor, the above
can become something like:

window.onload = function() {
var TextBoxName_FCK = new FCKeditor('TextBoxName');
TextBoxName_FCK.BasePath = "/fckeditor/";
TextBoxName_FCK.CustomConfigurationsPath = '/misc/fckmyconfig.js';
TextBoxName_FCK.ToolbarSet = "Medium";
TextBoxName_FCK.Height = "150";
TextBoxName_FCK.Width = "880";
TextBoxName_FCK.ReplaceTextarea();
}

Then create a label where CCS would usually put the call to the editor
being sure to remove CCS's own calls to it. Be sure to set the label's
type as HTML rather than the default of Text. In this example, the label
is called $FCKLoadEditor. Add a Before Show event to the label:

if ($Condition) {
ob_start();
include(RelativePath . "/misc/fckinclude.js");
$fckcontents = ob_get_contents();
ob_end_clean();
$FCKLoadEditor->SetValue("<script type=\"text/javascript\">\n".
$fckcontents . "\n</script>");
$FCKLoadEditor->Vibility = 1;
} else {
$FCKLoadEditor->Vibility = 0;
}

$Condition: whatever your condition is to show or hide the record and be
sure to change the path to your own location.

I understand that a CCS fix is in the works but in the meantime, this
should help, especially for users of the 3.X versions of CCS.

Don (DonP)
jjrjr1


Posts: 942
Posted: 05/02/2008, 9:32 AM

Don

Try this method and let me know what you think. I have passed this on to Helen at Yes and it might be implemented in a future release.

My fix is a little less code and I think a little simpler.

Also, This method will be easier for The Support Team to implement as a fix in CCS since it is only one line of code essentially and can be tied to the specific control during HTML generation.

Below is the code. Since each control that attaches an editor to it is generated all you have to do is conditionally attach each control as needed. This works since if a record is set to not visible, the HTML actually does not have the control defined.

In the case below cr_memberletters1 is the record that was set to not visible.

.//Attach FCKeditor @95-F50E89AC
var JRtest;
JRtest=typeof document.cr_memberletters1;// find out if the record is set to visible or not
if(JRtest!="undefined")//If the record is set to visible go make the attach
{
var cr_memberletters1ml_letter_FCK = new FCKeditor(this.getAttribute("id"));
cr_memberletters1ml_letter_FCK.BasePath = "FCKeditor/";
cr_memberletters1ml_letter_FCK.ToolbarSet = "Basic";
cr_memberletters1ml_letter_FCK.Height = "600";
cr_memberletters1ml_letter_FCK.Width = "600";
cr_memberletters1ml_letter_FCK.ReplaceTextarea();
}
//End Attach FCKeditor

Does that help?

If you have any questions, let me know.

John

_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.