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

I think it is necessary to have <base target="_self" /> in the <HEAD> of quantify.php.
Whether that is sufficient to resolve your problem, I don't know.

What does <base target="_self" /> do sir? Thanks for the reply anyway :D

I've tried it sir. The popuped page was sucessfully closed, but unfortunately, the main page still redirects to the home page.

I think this is a PHP problem: closing the popup is killing the session.
You will probably get quicker and more accurate answers in the PHP forum.

I don't think it has a problem with sessions sir, because it works perfectly fine on other browsers (especially firefox). I think that the real problem is the compatibility of showmodaldialog to IE. :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.