Home » HTML » HTML_AJAX » Bug #6957
automated parsing of javascript
Details
| Request #6957 | automated parsing of javascript |
|---|---|
| Submitted | 2006-02-28 09:06 UTC |
| From | white at ott-service dot de |
| Status | Closed |
| Package | HTML_AJAX |
| PHP Version | 4.4.0 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-02-28 09:06 UTC] white at ott-service dot de
Description:
------------
HTML_AJAX.replace does not automatically execute embedded javascript. An option to execute that code would be nice.
I tried to get hold of the new contents of the cell s1dbdatabase to find the javascript ands use eval, but it only shows the old content. before script execution.
var daten=document.getElementById('s1dbdatabase'); document.getElementById('debug').value=daten.innerHTML+"\n";
Test script:
---------------
In the main page:
[...]
HTML_AJAX.replace('s1dbdatabase','connect.php?server='+server+'&port='+port+'&user='+user+'&pass='+pass);
var daten=document.getElementById('s1dbdatabase'); document.getElementById('debug').value=daten.innerHTML+"\n";
conect.php (stripped);
<?php
$server=strip_tags($_REQUEST['server']);
$port=strip_tags($_REQUEST['port']);
$user=strip_tags($_REQUEST['user']);
$pass=strip_tags($_REQUEST['pass']);
$db = mysql_connect($server.($port != "3306" ? ":$port" : ""),$user,$pass);
if (!$db) {
?>
<script type="text/javascript">
var msg="Connect failed: <?php echo mysql_error; ?>";
alert(msg);
document.getElementById('error').innerHTML=msg;
</script>
<input type="button" value="Connect" onclick="javascript:dbconnect()" />
<?php
} else {
// other stuff here
}
?>
Expected result:
----------------
The javascript should be executed, a messagebox should appear and the "error" div should display that error.
Actual result:
--------------
the form field ist inserted, the javascript isn't executed.
[2006-03-03 15:42 UTC] white at ott-service dot de
Functionality works fine, just had to fix a little bug in HTML_AJAX.js on line 400
changed
makeFormAJAX(form,target,options) {
to
makeFormAJAX: function (form,target,options) {