Hi,
I have a form that I'm using as a top level menu for a web-enabled application. The form allows the user to select from a number of different computer systems by clicking a styled html anchor tag with an onclick event. The onclick calls javascript to set the value of a hidden (via css) submit input and then submit the form using the input's .click() method. This has worked for me in the past, and in this case, works just fine in Firefox, but not in IE 6.
Here is what I have verified:
1) When I click one of the anchor tags, the loadResource function fires.
2) When the .click() method is called, the click event on the submit input fires.
3) When the .click() method of the submit input fires, the PHP on the server does NOT get called.
4) If I unhide the submit input and click it manually, everything works.
At this point, I'm completely stumped. I hope someone can help.
Here's the form:
HTML Code:
<form name="systems" id="systems" action="outage.php" method="post">
<a id="Jade"
onclick="loadResource(event);"
href="javascript:{}">Jade</a>
<a id="Sapphire"
onclick="loadResource(event);"
href="javascript:{}">Sapphire</a>
<input id="system"
name="system"
value=""
class="sysBtn"
type="submit" />
<input type="hidden"
value="false"
name="write"/>
</form>
Here is the loadResource javascript function:
Code:
function loadResource(e) {
e = (typeof(event) == 'undefined') ? e : event;
var elem = $(e.target || e.srcElement);
var system = document.getElementById('system');
system.value = elem.id;
system.click();
}
On the server side, this is being handled by PHP. As a sanity check, I inserted the following code to show me what is actually being passed into the _POST array...
Code:
printf("<div>");
foreach($_POST as $key => $value){
printf("%s = %s<br />\n",$key, $value);
}
printf("</div>");
This code never gets called when the page is loaded in IE. It doesn't even generate the <div> tags.