Results 1 to 6 of 6

Thread: DHTML window widget as form target

  1. #1
    Join Date
    Mar 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML window widget as form target

    1) Script Title: DHTML Window Widget

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ndow/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:
    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');
    </script>
    
    <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???

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    <IFRAME NAME="myframe" ...>
    Then use that as the FORM's TARGET:

    Code:
    <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:

    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:

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

  3. #3
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    I didnt know that could be done...
    Neat.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  4. #4
    Join Date
    Mar 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thnx ddadmin...

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

  5. #5
    Join Date
    Nov 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    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?

    Thanks.

    Del.
    Last edited by dsharp; 11-01-2007 at 04:53 PM.

  6. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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 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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •