Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-03-27 09:31:01

Naatan
New member
Registered: 2007-03-27
Posts: 8

Textarea Data doesn't get submitted? (using PHP)

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

#2 2007-03-27 11:46:22

jedi58
Xinha Authority
From: Leicester, UK
Registered: 2007-01-14
Posts: 113
Website

Re: Textarea Data doesn't get submitted? (using PHP)

it should be accessible by looking at the value of $_POST['content']


David G. Paul
[url]http://www.newearthonline.co.uk[/url]

Offline

#3 2007-03-27 13:33:35

Naatan
New member
Registered: 2007-03-27
Posts: 8

Re: Textarea Data doesn't get submitted? (using PHP)

I know that, the very essence of the problem is that it's not..

Offline

#4 2007-03-27 16:11:45

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: Textarea Data doesn't get submitted? (using PHP)

How do you submit, I see no button in your form

Offline

#5 2007-03-29 08:08:37

Naatan
New member
Registered: 2007-03-27
Posts: 8

Re: Textarea Data doesn't get submitted? (using PHP)

Its just a default submit button..

<input type="submit" value="Submit" name="submit_newpagelanguage">

Offline

#6 2007-03-29 11:47:59

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: Textarea Data doesn't get submitted? (using PHP)

is $_POST['content'] not set at all, or does it just not contain the edited content? Does it work with aplain textarea?

Offline

#7 2007-03-30 06:22:12

Naatan
New member
Registered: 2007-03-27
Posts: 8

Re: Textarea Data doesn't get submitted? (using PHP)

$_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. smile

Offline

#8 2007-03-31 14:58:01

Naatan
New member
Registered: 2007-03-27
Posts: 8

Re: Textarea Data doesn't get submitted? (using PHP)

Anyone? You can't tell me this is a completely new bug sad

Offline

#9 2007-04-02 08:47:06

jelmer
Xinha Community Member
Registered: 2007-01-11
Posts: 11

Re: Textarea Data doesn't get submitted? (using PHP)

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

#10 2007-04-06 11:16:46

thetazzbot
New member
Registered: 2007-04-06
Posts: 4

Re: Textarea Data doesn't get submitted? (using PHP)

He shouldn't have to do that with his submit button.

Offline

#11 2007-04-07 06:02:44

Naatan
New member
Registered: 2007-03-27
Posts: 8

Re: Textarea Data doesn't get submitted? (using PHP)

jelmer wrote:

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

#12 2007-04-07 06:22:24

Naatan
New member
Registered: 2007-03-27
Posts: 8

Re: Textarea Data doesn't get submitted? (using PHP)

I solved it smile I don't know what the actual problem was, but after validating and fixing my page with the w3c validator it all worked! smile

Thanks for the help all and sorry for the inconvenience

Offline

#13 2008-02-11 07:38:43

shadowq
New member
Registered: 2007-06-26
Posts: 4

Re: Textarea Data doesn't get submitted? (using PHP)

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

#14 2008-02-12 08:59:50

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Textarea Data doesn't get submitted? (using PHP)

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

#15 2008-02-12 18:28:21

shadowq
New member
Registered: 2007-06-26
Posts: 4

Re: Textarea Data doesn't get submitted? (using PHP)

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

Board footer

Powered by FluxBB