I suspect that the real problem is that I don't have a deep enough understanding of the php backend vs js frontend interaction. I may have 30 years' C experience, but I do struggle a bit at the moment with some of these ideas, and their practical implementation. BUT maybe someone can give me a guideline. Scenario is....
I have a frontent php script which is actually 99% jscript. It call lots of php backend scripts, which return html that the jscript pokes into various divs on the page. The php scripts also update a mysql database. All works fine except the fck bit. The backend phps includes stuff like this......
----------------------------------------------------------------------------------------
$display_string .= "<input type='button' value='Add BEFORE currently selected page' onClick=\"MyObject.UpdateEditorFormValue();addbefore('$acode',this.form)\">";
$fcked1 = new FCKeditor('FCKeditor1') ;
$fcked1->BasePath = './fckeditor/';
$fcked1->Value = 'Enter information for the CLIENT here...';
$fcked1->ToolbarSet = 'Basic' ;
$output1 = $fcked1->CreateHtml() ;
$display_string .= $output1;
-------------------------------------------------------------------------------------------
where $display_string is passed back to the frontent and inserted into a div. The problem is that all the fields in this.form are updated fine except for the fck fields, which always return their initial ->Value.
The frontent also includes the following bits of code - firstly the fix to update the contents of the fck area...
-------------------------------------------------------------------------------------------
// Some Class - this is a fix to make the FCK editor itself / returning form data
function MyClass()
{
this.UpdateEditorFormValue = function()
{
for ( i = 0; i < parent.frames.length; ++i )
if ( parent.frames[i].FCK )
parent.frames[i].FCK.UpdateLinkedField();
};
}
// instantiate the class
var MyObject = new MyClass();
---------------------------------------------------------------------------------------------
and then code to retrieve and display the string from the backend
---------------------------------------------------------------------------------------------
function ArtworkNew2(acode){
NewRequest = new NewReq();
// Create a function that will receive data sent from the server
NewRequest.onreadystatechange = function(){
if(NewRequest.readyState == 4){
ResultDisplay = document.getElementById('PageDiv');
ResultDisplay.innerHTML = NewRequest.responseText;
}
}
// Build the stuff to be sent to the backend
NewRequest.open("GET", "port_awnew3.php", true);
NewRequest.send(null);
}
-------------------------------------------------------------------------------------------
and finally the stuff to use the values from the fields in this.form
-------------------------------------------------------------------------------------------
function addbefore(artwork,form)
{
NewRequest = new NewReq(); // The variable that makes Ajax possible!
//alert("ab1");
// Create a function that will receive data sent from the server
NewRequest.onreadystatechange = function(){
if(NewRequest.readyState == 4){
ResultDisplay = document.getElementById('DebugDiv');
ResultDisplay.innerHTML = NewRequest.responseText;
LocDisplay = document.getElementById('LocDiv');
LocDisplay.innerHTML = "port_addbefore.php";
ShowPages(0);
}
}
// Build the stuff to be sent to the backend
//alert("ab2");
var reqString = '';
//alert("ab4");
$sValue1 = form.FCKeditor1.value ;
$sValue2 = form.FCKeditor2.value ;
reqString += "?artworkcode=" + artwork + "&custinfo=" + escape($sValue1) + "&acinfo=" + escape($sValue2);
reqString += "&mtop=" + form.mtop.value + "&mside=" + form.mside.value + "&mbot=" + form.mbot.value;
reqString += "&moulding=" + form.MouldingList.value + "&glass=" + form.GlassList.value + "&backing=" + form.BackingList.value;
reqString += "&m1=" + form.Mount1List.value + "&m2=" + form.Mount2List.value + "&m3=" + form.Mount3List.value;
reqString += "&d1=" + form.Dec1List.value + "&d2=" + form.Dec2List.value;
reqString += "&d3=" + form.Dec3List.value + "&d4=" + form.Dec4List.value;
reqString += "&d5=" + form.Dec5List.value + "&d6=" + form.Dec6List.value;
reqString += "&d7=" + form.Dec7List.value + "&d8=" + form.Dec8List.value;
reqString += "&f1=" + form.Fix1List.value + "&f2=" + form.Fix2List.value;
reqString += "&dn1=" + form.dn1.value + "&dn2=" + form.dn2.value;
reqString += "&dn3=" + form.dn3.value + "&dn4=" + form.dn4.value;
reqString += "&dn5=" + form.dn5.value + "&dn6=" + form.dn6.value;
reqString += "&dn7=" + form.dn7.value + "&dn8=" + form.dn8.value;
//alert(reqString);
NewRequest.open("GET", "port_addbefore.php" + reqString, true);
NewRequest.send(null);
//alert("ab5");
}
----------------------------------------------------------------------------------------
and, as I say, all the form fields are updated every time the function is used, except the fck ones.
ANT IDEAS - please!!
Cheers,
Alyn Ashworth.
I have a frontent php script which is actually 99% jscript. It call lots of php backend scripts, which return html that the jscript pokes into various divs on the page. The php scripts also update a mysql database. All works fine except the fck bit. The backend phps includes stuff like this......
----------------------------------------------------------------------------------------
$display_string .= "<input type='button' value='Add BEFORE currently selected page' onClick=\"MyObject.UpdateEditorFormValue();addbefore('$acode',this.form)\">";
$fcked1 = new FCKeditor('FCKeditor1') ;
$fcked1->BasePath = './fckeditor/';
$fcked1->Value = 'Enter information for the CLIENT here...';
$fcked1->ToolbarSet = 'Basic' ;
$output1 = $fcked1->CreateHtml() ;
$display_string .= $output1;
-------------------------------------------------------------------------------------------
where $display_string is passed back to the frontent and inserted into a div. The problem is that all the fields in this.form are updated fine except for the fck fields, which always return their initial ->Value.
The frontent also includes the following bits of code - firstly the fix to update the contents of the fck area...
-------------------------------------------------------------------------------------------
// Some Class - this is a fix to make the FCK editor itself / returning form data
function MyClass()
{
this.UpdateEditorFormValue = function()
{
for ( i = 0; i < parent.frames.length; ++i )
if ( parent.frames[i].FCK )
parent.frames[i].FCK.UpdateLinkedField();
};
}
// instantiate the class
var MyObject = new MyClass();
---------------------------------------------------------------------------------------------
and then code to retrieve and display the string from the backend
---------------------------------------------------------------------------------------------
function ArtworkNew2(acode){
NewRequest = new NewReq();
// Create a function that will receive data sent from the server
NewRequest.onreadystatechange = function(){
if(NewRequest.readyState == 4){
ResultDisplay = document.getElementById('PageDiv');
ResultDisplay.innerHTML = NewRequest.responseText;
}
}
// Build the stuff to be sent to the backend
NewRequest.open("GET", "port_awnew3.php", true);
NewRequest.send(null);
}
-------------------------------------------------------------------------------------------
and finally the stuff to use the values from the fields in this.form
-------------------------------------------------------------------------------------------
function addbefore(artwork,form)
{
NewRequest = new NewReq(); // The variable that makes Ajax possible!
//alert("ab1");
// Create a function that will receive data sent from the server
NewRequest.onreadystatechange = function(){
if(NewRequest.readyState == 4){
ResultDisplay = document.getElementById('DebugDiv');
ResultDisplay.innerHTML = NewRequest.responseText;
LocDisplay = document.getElementById('LocDiv');
LocDisplay.innerHTML = "port_addbefore.php";
ShowPages(0);
}
}
// Build the stuff to be sent to the backend
//alert("ab2");
var reqString = '';
//alert("ab4");
$sValue1 = form.FCKeditor1.value ;
$sValue2 = form.FCKeditor2.value ;
reqString += "?artworkcode=" + artwork + "&custinfo=" + escape($sValue1) + "&acinfo=" + escape($sValue2);
reqString += "&mtop=" + form.mtop.value + "&mside=" + form.mside.value + "&mbot=" + form.mbot.value;
reqString += "&moulding=" + form.MouldingList.value + "&glass=" + form.GlassList.value + "&backing=" + form.BackingList.value;
reqString += "&m1=" + form.Mount1List.value + "&m2=" + form.Mount2List.value + "&m3=" + form.Mount3List.value;
reqString += "&d1=" + form.Dec1List.value + "&d2=" + form.Dec2List.value;
reqString += "&d3=" + form.Dec3List.value + "&d4=" + form.Dec4List.value;
reqString += "&d5=" + form.Dec5List.value + "&d6=" + form.Dec6List.value;
reqString += "&d7=" + form.Dec7List.value + "&d8=" + form.Dec8List.value;
reqString += "&f1=" + form.Fix1List.value + "&f2=" + form.Fix2List.value;
reqString += "&dn1=" + form.dn1.value + "&dn2=" + form.dn2.value;
reqString += "&dn3=" + form.dn3.value + "&dn4=" + form.dn4.value;
reqString += "&dn5=" + form.dn5.value + "&dn6=" + form.dn6.value;
reqString += "&dn7=" + form.dn7.value + "&dn8=" + form.dn8.value;
//alert(reqString);
NewRequest.open("GET", "port_addbefore.php" + reqString, true);
NewRequest.send(null);
//alert("ab5");
}
----------------------------------------------------------------------------------------
and, as I say, all the form fields are updated every time the function is used, except the fck ones.
ANT IDEAS - please!!
Cheers,
Alyn Ashworth.
RE: fck contents not updating
RE: fck contents not updating
Get and set content of the editor with the API commands GetXHTML and SetHTML : http://wiki.fckeditor.net/Developer%27s ... script_API
You might also be interested in my AjaxPost plugin:
personal page and demo for the plugin: http://www.saulmade.nl/FCKeditor/FCKPlugins.php
plugin and download page at sourceforge: http://sourceforge.net/tracker/index.ph ... tid=737639
forumThread: http://sourceforge.net/forum/forum.php? ... _id=257179