PDA

View Full Version : DHTML Modal window



Jet-li
06-05-2007, 04:15 AM
1) Script Title: DHTML Modal window

2) Script URL (on DD): DHTML Modal window (http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/dhtmlmodal.htm)

3) Describe problem: Is it possible to use it from a form action like this?


<form action="" method="post" onsubmit="">
<input type="text" name="productID" value="" size="20" maxlength="30">
<input name="image" type="image" src="../images/searchbutton.gif" alt="Search" onsubmit="productSearch('http://www.mydomain.com/searchresult.php'); return false">
</form>

I want to use a form to search for a product and the result should popup in DHTML Modal window.

Jet-li
06-05-2007, 07:30 PM
This is how i want to have the code. But it don't like to open the window at all so something must be wrong with it......


<script type="text/javascript">
function productSearch(url){
var productSearchwin=dhtmlmodal.open("productSearchbox", "iframe", url, "product search result", "width=590px,height=450px,center=1,resize=1,scrolling=0", "recal")

}
</script>

<h3>Enter product Name:</h3>
<form name="product">
<input name="productID" type="text"/>
<input name="image" type="image" src="../images/searchbutton.gif" alt="Search" onsubmit="performerSearch('product.php')"/>
</form>

imvain2
06-05-2007, 07:33 PM
I maybe wrong on this, but I believe onsubmit is used in the form tag. Try changing onsubmit to onclick.

Jet-li
06-05-2007, 08:51 PM
It was make some improvmets but now i got the problem how to get the productID into the iframe. Like it is now it load the iframe and close it, and this i think it's because the productID goes into the mainpage and not into the iframe......

Jet-li
06-05-2007, 09:20 PM
<script type="text/javascript">
function productSearch(url){
var productSearchwin=dhtmlmodal.open("productSearchbox", "iframe", url, "product search result", "width=590px,height=450px,center=1,resize=1,scrolling=0", "recal")

}
</script>

<h3>Enter product Name:</h3>
<form name="product">
<input name="productID" type="text"/>
<input name="image" type="image" src="../images/searchbutton.gif" alt="Search" onClick="performerSearch('product.php'); return false"/>
</form>
did ad code in red i was missing and the ifram popup like it should.Now the only problem is to get text value into the iframe....

Jet-li
06-05-2007, 09:52 PM
<script type="text/javascript">

function productSearch(url) {
var myForm=document.Product
var myValue=myForm.productID.value

if (myValue!="") {
productSearchwin=dhtmlmodal.open("productSearchbox", "iframe", url + myValue, "product search result", "width=590px,height=450px,center=1,resize=1,scrolling=0", "recal")
} else {
alert("Please enter value.")
}

}
</script>

<h3>Enter Product Name:</h3>
<form name="Product" method="post">
<input name="productID" type="text"/>
<input name="image" type="image" src="../images/searchbutton.gif" alt="Search" onClick="productSearch('product.php?'); return false"/>
</form>

Now i got it to work :) My first attempt with javascript and it's ending with succes :p

webadnan
02-12-2009, 01:19 PM
hi jet li,

i have the same problem with you. i am trying to post form values onto an email.asp page via contact form. i tried what you coded but it failed. i thisnk it is about onsubmit command. :(( how can i do it??