Opened 14 years ago

Closed 14 years ago

#745 closed defect (duplicate)

Xinha content not saved(submitted) when javascript event used to submit form

Reported by: Brice Burgess Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version:
Severity: normal Keywords:
Cc:

Description

If the form with the Xinha editor is submitted via a javascript event handler (ie. a <select> tag with onChange="document.form.submit()" ), any content entered into the Xinha editor is lost -- doesn't show up in the HTTP POST/GET vars.

Here's a example in PHP -- obviously the locations of htmlarea.js and config.js needs to be changed to match your example. Type some text in the body, and submit it with the form button. You'll notice what you typed shows up in POST. Now type some things in & submit the form via the select element. body in POST will be empty.

This was tested under Firefox 1.5.0.1 and IE6


<html>
<head>
<script type="text/javascript">

_editor_url = "/eclipse/bMail/inc/xinha/";
_editor_lang = "en";

</script>
<script type="text/javascript" src="/eclipse/bMail/inc/xinha/htmlarea.js"></script>
<script type="text/javascript" src="/eclipse/bMail/inc/xinha/config.js"></script>
</head>
<body>

<form name="form" id="form" action="<?php echo htmlspecialchars($_SERVERPHP_SELF?); ?>" method="POST">

<textarea name="body" id="body"></textarea>

<br>

<select name="select" onChange="document.form.submit()">

<option value="1">Change</option>
<option value="2">Me To</option>
<option value="3">Submit Form</option>

</select>

<input type="submit" name="button" value="submit type button">

</form>
<?php
var_dump($_POST);
?>
</body>
</html>


Change History (2)

comment:1 Changed 14 years ago by anonymous

  • Component changed from Documentation to Xinha Core
  • Owner changed from akaEdge to gogo

comment:2 Changed 14 years ago by wymsy

  • Resolution set to duplicate
  • Status changed from new to closed

see #450

Note: See TracTickets for help on using tickets.