Hi guys,
I'm still a newbie in javascript so i ask for a bit of your patience. hehe.
So here is my problem with showmodaldialog. It only occurs in IE.
I basically have 2 php pages. One is produst_list.php, and the other is quantify.php.
product_list.php basically calls the quantify.php page to quantify products that are being ordered in product_list.php page, then calls back the product_list.php page to display the quantity entered in quantify.php
product_list.php
//it basically has this code
<td><a href="" onClick="window.showModalDialog('quantify.php?product=<?php echo $product ?>',window,'dialogHeight=200px;dialogWidth=400px;resizable:no;');">ADD</a></td>
quantify.php
//it has this javascript code here for validation purposes.
<script type="text/javascript">
function validate()
{
var given = document.form1.qty.value;
var max = document.form1.max.value;
if(parseFloat(given) > parseFloat(max))
{
alert("Value entered is greater than what is on stock. Please check the current quantity of the product.");
}
else
{
document.form1.btn.click();
}
}
</script>
//this is the form of quantify.php that calls back the product_list.php
<form name="form1" action="product_list.php" method="get">
<input type="text" name="qty" />
<input type="button" value="Submit" onclick="validate();"/>
<input type="button" value="Cancel" onclick="window.close();"/>
<input type="submit" name="btn" onclick="window.close();" style="display:none" />
</form>
Whenever I submit the form or close the popuped window (quantify.php), the main page (product_list.php) that is on the background unintentionally jerks and redirects to the homepage of my site and product_list.php transfers to the popuped window with the values I entered.
Wierd!
These are just parts of the code that I think brought the problem. I have done all the extractions of get and post and it all works in major browsers except in IE. I think the showmodaldialog has the problem.
Any help guys? Or any suggestions? I want to keep the pop up cause I think its pretty cool. hehe