You are not logged in.
Hi there.
I have xinha implemented in a php script but the content entered in the textarea form box does not get submitted.. and I can't figure out how.
My xinha code in the header section looks like this:
<script type="text/javascript">
_editor_url = "../includes/wysiwyg/xinha/";
_editor_lang = "en"; // And the language we need to use in the editor.
</script>
<!-- Load up the actual editor core -->
<script type="text/javascript" src="../includes/wysiwyg/xinha/htmlarea.js"></script>
<script type="text/javascript">
xinha_editors = null;
xinha_init = null;
xinha_config = null;
xinha_plugins = null;
// This contains the names of textareas we will make into Xinha editors
xinha_init = xinha_init ? xinha_init : function()
{
xinha_plugins = xinha_plugins ? xinha_plugins :
[
'ImageManager',
'SpellChecker',
'Stylist'
];
// THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :)
if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;
xinha_editors = xinha_editors ? xinha_editors :
[
'content'
];
xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();
xinha_config.width = 'auto';
xinha_config.height = 'auto';
xinha_config.pageStyle = 'body { font-family: Trebuchet MS, sans-serif; font-size: 12px; }';
xinha_config.SpellChecker = { 'backend' : 'php', 'personalFilesDir' : '', 'defaultDictionary' : 'en_US' };
xinha_config.toolbar =
[
["popupeditor"],["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],
["separator","forecolor","hilitecolor"],
["separator","subscript","superscript"],
["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
["separator","inserthorizontalrule","createlink","insertimage","inserttable"],
["separator","undo","redo"],
["separator","removeformat","toggleborders","separator","htmlmode","about"]
];
xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
HTMLArea.startEditors(xinha_editors);
window.onload = null;
}
window.onload = xinha_init;
</script>
Now the code in my body section looks like this:
<form method="POST" action="pages.php">
<textarea id="content" name="content" style="height: 300px; width: 100%;"></textarea>
</form>
In pages.php I put a bit of code to return all the variables being passed by the browser:
foreach($_REQUEST as $key=>$value){
echo "$key : $value<br><br><hr><br>";
}
but content is nowhere to be seen..
Does anyone know what im doing wrong?
Offline
I know that, the very essence of the problem is that it's not..
Offline
Its just a default submit button..
<input type="submit" value="Submit" name="submit_newpagelanguage">
Offline
$_POST['content'] is not set at all.
If what you mean by 'plain textarea' is a textarea without Xinha applied to it then yes, it does work.. Only when I apply Xinha to it it somehow doesn't process right.
And yes i'm using the latest version.
Offline
Anyone? You can't tell me this is a completely new bug
Offline
you can try the following (it worked for me)
make the submit-button as follows:
<input type="button" value="Submit" name="submit_newpagelanguage" onClick="javascript:this.form.onSubmit();this.form.submit()">
so you call onSubmit() before really submitting and that should do the trick!
Offline
He shouldn't have to do that with his submit button.
Offline
you can try the following (it worked for me)
make the submit-button as follows:
<input type="button" value="Submit" name="submit_newpagelanguage" onClick="javascript:this.form.onSubmit();this.form.submit()">
so you call onSubmit() before really submitting and that should do the trick!
using your code gave me a javascript error (this.form.onsubmit is not a function), so I used the following instead:
onClick="this.form.submit()"
this didn't return any POST values at all though.. very weird
Offline
I solved it I don't know what the actual problem was, but after validating and fixing my page with the w3c validator it all worked!
Thanks for the help all and sorry for the inconvenience
Offline
I'm having the same problem. When 'Posting' to another page via php, the variable isn't set at all.
My Xinha Config is as follows-
xinha_editors = null;
xinha_init = null;
xinha_config = null;
xinha_plugins = null;
// This contains the names of textareas we will make into Xinha editors
xinha_init = xinha_init ? xinha_init : function()
{
/** STEP 1 ***************************************************************
* First, what are the plugins you will be using in the editors on this
* page. List all the plugins you will need, even if not all the editors
* will use all the plugins.
*
* The list of plugins below is a good starting point, but if you prefer
* a must simpler editor to start with then you can use the following
*
* xinha_plugins = xinha_plugins ? xinha_plugins : [ ];
*
* which will load no extra plugins at all.
************************************************************************/
xinha_plugins = xinha_plugins ? xinha_plugins :
[
'CharacterMap',
'ContextMenu',
'ListType',
'ExtendedFileManager',
'Stylist',
'Linker',
'SuperClean',
'TableOperations'
];
// THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :)
if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
/** STEP 2 ***************************************************************
* Now, what are the names of the textareas you will be turning into
* editors?
************************************************************************/
xinha_editors = xinha_editors ? xinha_editors :
[
'newsletter2'
];
/** STEP 3 ***************************************************************
* We create a default configuration to be used by all the editors.
* If you wish to configure some of the editors differently this will be
* done in step 5.
*
* If you want to modify the default config you might do something like this.
*
* xinha_config = new Xinha.Config();
* xinha_config.width = '640px';
* xinha_config.height = '420px';
*
*************************************************************************/
xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
/* Stuff I added */
xinha_config.statusBar = false;
xinha_config.showLoading = true;
xinha_config.toolbar =
[
["popupeditor"],
["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],
["separator","forecolor","hilitecolor","textindicator"],
["separator","subscript","superscript"],
["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
["separator","inserthorizontalrule","createlink","insertimage","inserttable"],
["linebreak","separator","undo","redo","selectall","print"], (Xinha.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]),
["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright", "righttoleft"],
["separator","htmlmode","showhelp"]
];
/** STEP 4 ***************************************************************
* We first create editors for the textareas.
*
* You can do this in two ways, either
*
* xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
*
* if you want all the editor objects to use the same set of plugins, OR;
*
* xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config);
* xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
* xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
*
* if you want to use a different set of plugins for one or more of the
* editors.
************************************************************************/
xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
/** STEP 5 ***************************************************************
* If you want to change the configuration variables of any of the
* editors, this is the place to do that, for example you might want to
* change the width and height of one of the editors, like this...
*
* xinha_editors.myTextArea.config.width = '640px';
* xinha_editors.myTextArea.config.height = '480px';
*
************************************************************************/
/** STEP 6 ***************************************************************
* Finally we "start" the editors, this turns the textareas into
* Xinha editors.
************************************************************************/
Xinha.startEditors(xinha_editors);
}
Xinha._addEvent(window,'load', xinha_init); // this executes the xinha_init function on page load
// and does not interfere with window.onload properties set by other scripts
In my first page, I've got
<textarea id=newsletter2 name=newsletter2 rows="30" style="width:80%"></textarea>
which is sent to itself, it checks that the form's been submitted, then send an email with the content.
After doing some fiddling, I've found that it's whatever textarea Xinha is formatting. If Xinha's not touching my textarea, it works fine- but as soon as Xinha touches it, it won't send any content through the form (it treats it as an empty field).
Any ideas? Anything will be greatly appreciated. I've spent way too many hours playing with it already.
Thanks in advance,
Jarrod.
Offline
Are you submitting with just your normal old form submit button?
Does your page validate, or at least come close?
Check especially you're not trying to do something like:
<table><form><tr>
or
<table><tr><form><td>
James Sleeman
Offline
Hey James,
Thanks for you reply. I feel like an absolute idiot now. I had the <form> inside of the table, but the </form> outside of the table.
the w3c validator didn't pick that up.
Oh well, it's all working now.
Thank you.
Jarrod.
Offline