I have a list of "files" created in a database. They are records of a note name, the note text/html, note id, etc.
You can click a note in the list and it reads the database and loads the text into the editor. I hard coded ajaxPost to update just one of my notes in the database. Now I'm trying to load the note id of the selected from the list into my fckeditor and pass it through ajaxPost with variable set by getElementById from hidden input field. But can't get it to work.
from my editor page:
Here is how I hard coded it. It always saves to the record with note_id of 1 and is pasted through my php script saveAdapter.php. This worked.
from ajaxPost.js:
Instead of
I put
I even tried putting that by itself at the top of ajaxPost.js
It's doesn't work?
You can click a note in the list and it reads the database and loads the text into the editor. I hard coded ajaxPost to update just one of my notes in the database. Now I'm trying to load the note id of the selected from the list into my fckeditor and pass it through ajaxPost with variable set by getElementById from hidden input field. But can't get it to work.
from my editor page:
//some php/mysql up here $note_id = id of text from db $notehtml = text from db $page_content = " <form> <input type=\"hidden\" id=\"note_id\" value=\"$note_id\"> <script type=\"text/javascript\"> var oFCKeditor = new FCKeditor('FCKeditor1'); oFCKeditor.ToolbarSet = 'MyNotes' ; oFCKeditor.BasePath = \"/CV/includes/javascripts/fckeditor/\"; oFCKeditor.Value = '$notehtml'; oFCKeditor.Height = \"400\" ; oFCKeditor.Create(); </script> </form> ";
Here is how I hard coded it. It always saves to the record with note_id of 1 and is pasted through my php script saveAdapter.php. This worked.
from ajaxPost.js:
// post AxpObject.prototype.post = function () { // set up the requestObject this.initialize(); var note_id = '1'; // make request requestObject.open('POST', this.FCKConfig.ajaxPostTargetUrl + '?note_id=' + note_id, true); requestObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); requestObject.send('action=save&content=' + encodeURIComponent(this.editorInstance.GetXHTML())); }
Instead of
var note_id = '1';
I put
var note_id = document.getElementById('note_id');
I even tried putting that by itself at the top of ajaxPost.js
It's doesn't work?