SitePoint Sponsor |
|
User Tag List
Results 1 to 11 of 11
-
Jun 10, 2007, 01:32 #1
- Join Date
- Jun 2005
- Location
- Florida
- Posts
- 142
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ajax generated form fields value not posted in Firefox browser
Dynamically AJAX generated form fields value are posted successfully in IE browser but the same thing not working in Firefox browser.
I checked printing $_POST array ie <? print_r($_POST); ?>. Those Ajax generated form fields are displayed as $_POST array index while using IE browser but the same fields are displayed as $_POST array index.
Please give me solution fast...its urgent
-
Jun 10, 2007, 01:47 #2
Which Ajax package do you use?
Post your form code!
-
Jun 10, 2007, 02:55 #3
- Join Date
- Jun 2005
- Location
- Florida
- Posts
- 142
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Basic code associated with this part is
<script>
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest){
XMLHttpRequestObject = new XMLHttpRequest();
}else if(window.ActiveXObject){
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
function getSystemSubClassAjax(whereto, divID, controlID){
if (XMLHttpRequestObject){
show_loading();
var obj = document.getElementById(divID);
var variables = "systemid=" + controlID.value;
XMLHttpRequestObject.open("POST", whereto, true);
XMLHttpRequestObject.setRequestHeader("Content-type","application/x-www-form-urlencoded")
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 1){
}
else if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200){
obj.innerHTML = XMLHttpRequestObject.responseText;
hide_loading();
}
}
XMLHttpRequestObject.send(variables);
}
}
</script>
-
Jun 10, 2007, 07:27 #4
I don't see where you assign your variables
XMLHttpRequestObject.send(variables);
-
Jun 10, 2007, 07:33 #5
- Join Date
- Jun 2007
- Location
- The Netherlands
- Posts
- 112
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Last edited by Servyces; Jun 13, 2007 at 10:40.
Servyces.com
Where it’s all about you.
Your partner in online solutions.
Visit our website at http://www.servyces.com/
-
Jun 10, 2007, 21:15 #6
-
Jun 11, 2007, 23:21 #7
- Join Date
- Jun 2005
- Location
- Florida
- Posts
- 142
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Dynamically generated form fields:
<select name="systemid" class="box_blue" onChange="getSystemSubClassAjax('../includes/medicine_process.php','divDisplayChoice',this)">
<option>System</option>
<?php
while ($systemdata = mysql_fetch_array($SystemName)){
echo '<option value="' . $systemdata['system_id'] . '">' . $systemdata['system_name'] . '</option>';
}
</select>
<div id="divDisplayChoice" align="left"></div>
-
Jun 11, 2007, 23:22 #8
- Join Date
- Jun 2005
- Location
- Florida
- Posts
- 142
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Dynamically generated form fields:
<select name="systemid" class="box_blue" onChange="getSystemSubClassAjax('../includes/medicine_process.php','divDisplayChoice',this)">
<option>System</option>
<?php
while ($systemdata = mysql_fetch_array($SystemName)){
echo '<option value="' . $systemdata['system_id'] . '">' . $systemdata['system_name'] . '</option>';
}
?>
</select>
<div id="divDisplayChoice" align="left"></div>
-
Jun 11, 2007, 23:28 #9
- Join Date
- Jun 2005
- Location
- Florida
- Posts
- 142
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
<?
//medicine_process.php
session_start();
require_once("../includes/clsDbconn.php");
require_once("../includes/clsSystem.php");
$objDbconn = new Dbconn();
$objSystem = new System();
$result = $objSystem -> getSystemSubClassByidAjax($_POST["systemid"]);
if($result){
$display = "";
while($row = mysql_fetch_assoc($result)){
$display .= "<div><input type='checkbox' name='chkSystemId[]' value='" . $row['system_id'] . "' />" . $row['system_name'] . "</div>";
}
echo $display;
}else{
echo "No data found";
}
?>
-
Jun 12, 2007, 03:34 #10
Now I see where the real problem is.
This code is not cross browser, but works in IE only:
controlID.value
controlID.options[controlID.selectedIndex].value;
-
Jun 12, 2007, 03:46 #11
- Join Date
- Sep 2006
- Posts
- 12
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Have you taken a look at jquery. It's a free cross browser java script library that will make your ajax/javascript life MUCH easier and reduce code size considerably.
I have used it for a couple of projects, and LOVE it.
(No affiliation with them other than being a fan).
-JasonR
Bookmarks