View Full Version : DHTML window widget as form target

03-28-2007, 04:23 PM
1) Script Title: DHTML Window Widget

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem:
I would like to submit a form into a iframe window widget which is allready there.

I tried to just direct a link into the iframe by using <a href="index.php" target="windowwidget"> but this just opens a new page.

here's part of my code:

<script type="text/javascript">
Process=dhtmlwindow.open('Processor', 'iframe', 'about:blank', 'DebugWin', 'width=400px,height=100px,left=-150px,top=0px,resize=1,scrolling=1');

<a href="index.php" target="Process">TargetTest 1</a><br>
<a href="index.php" target="Processor">TargetTest 2</a><br>
<a href="index.php" target="DebugWin">TargetTest 3</a><br>

neither of the <a>'s work... so i really don't have a clue on how to do this...

can anybody please help me with this???

03-28-2007, 10:11 PM
Well, in general, to to target a FORM's result to an iframe, you would do this:

Give your IFRAME a NAME attribute, such as:

<IFRAME NAME="myframe" ...>

Then use that as the FORM's TARGET:

<FORM TARGET="myframe" ...>

Having said that, the key to targeting a FORM's content to a DHTML window widget that's an iframe is to know the name of this iframe. Assuming you've opened a DHTML window using the below code:

var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://images.google.com/", "#1: Google Web site", "width=590px,height=350px", "recal")

The IFRAME's name then will always be "_iframe-googlebox". Note the "_iframe-" prefix to the first parameter.

So to answer your question, a FORM that submits its contents to the above window widget would look like this:

<form target="_iframe-googlebox" action="http://www.mysite.com/submit.php">

<input type="submit" />


03-28-2007, 11:24 PM
I didnt know that could be done...

03-29-2007, 09:33 AM
thnx ddadmin...

It works great... I just had to know the "_iframe-" prefix...

11-01-2007, 04:33 PM

If the ajax version of the window is used, the form target of _ajax-googlebox doesn't work.

Is there a way of targeting the ajax window at all from forms, or is the solution to use the IFRAME version?



11-02-2007, 05:27 AM
If you need a form to target a non IFRAME DHTML window, the solution doesn't lie so much in the later, but with tweaking your form submission script to return the results dynamically, whether inside the DHTML window DIV or any other DIV on the page. In other words, you'll need to modify your form script to become an Ajax form submission (http://search.yahoo.com/search?p=ajax+form+submission&fr=yfp-t-501&toggle=1&cop=mss&ei=UTF-8&vc=&fp_ip=CA) script. It has nothing to do with DHTML widget per say. The reason the IFRAME version of the widget works automatically with form targeting is because forms inherently support outputting to a particular frame or iframe. It's not a feature custom built into the widget script.