Dynamic Form Elements in Firefox not Displaying



This is my first crack at an AJAX type of idea... The plan is to update
a forms options based on items selected. The application is for
tracking hardware. The database has various "specs" assigned to each
piece of hardware. For example...

PC's may have specs like "RAM", "HD Space" etc. while a monitor would
have specs like "Screen Size", "Monitor Type", etc.

What I've done is set up a form, so when someone selects a type for the
equipment entry page, there's an onchange method that is called in
javascript.

Here's the form info...

Equipment Type:
<select name="type_uid" onchange="build_type(this);">
<option value="">SELECT</option>
<option value="1">PC</option>
<option value="2">Monitor</option>
</select>

The Javascript called is...

<script language="javascript" type="text/javascript">
function build_type(inSelection){
var url = "decision_page.php?inSelection="+inSelection.value;
frames[0].location.href=url;
}
</script>


This calls an iFrame that is located at the bottom of the same page...
<iframe
id="IFRM_build_specs"
src="anything.htm"
width="0"
height="0">
</iframe>


The page that is called by the javascript looks like this...

<?php
// check to make sure something is passed in a link
if(isset($_GET["inSelection"])){
// set a local variable for what's passed
$display_selection = $_GET["inSelection"];

// run a query to get all specs
$sql = "SELECT * FROM table WHERE uid = '$display_selection'";
$result = $firstlook->Execute($sql) or
DIE($firstlook->ErrorMsg());

// start building a return table for the form
$return_info = "<table class='sm_table'>";

while (!$result->EOF) {
$return_info .= "<tr>";
$return_info .= "<td
align='right'>".$result->fields("name").": </td>";
$return_info .= "<td><input type='text'
name='spec[".$result->fields("uid")."]' ></td>";
$return_info .= "</tr>";
$result->MoveNext();
}
$return_info .= "</table>";
}
else {
$return_info = "&nbsp;";
}
?>

Here's the javascript that sends back the dynamically built table of
form fields...

<script language="javascript" type="text/javascript">
parent.document.getElementById('build_specs').innerHTML =
"<?=$return_info?>";
</script>

Back on the main page, the html that it should drop into looks like
this...

<tr valign="top">
<td class="bodybld">Specs:</td>
<td><div id="build_specs">&nbsp;</div></td>
</tr>



Now.... when I fill out the form in IE and submit it, there are values
for the dyanmically built fields that get dropped in where the
"build_specs" ID is above, but when I do it in Firefox, nothing is
passed.

I'm checking to see what's sent by echoing out the value of the $_POST
array like so...

if(isset($_POST["submit_form"])){ // checking for submit button
echo "<pre>";print_r($_POST);echo "</pre>";
exit;
}

Please let me know if you see anything. Sorry for the large snippets.
D.

.


Quantcast