Results 1 to 5 of 5

Thread: DHTML Window widget to pass back value

  1. #1
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML Window widget to pass back value

    1) Script Title: (v1.03)

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

    3) Describe problem: I open testme.asp in DHTML Window widget from testbatch.asp I want testme.asp to enter selected value in textbox of parent page testbatch.asp

    It would be really nice if widget would close and put the value in the textbox when submit is pressed in form control

  2. #2
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Tried to use some javascript in widget:
    <script language="JavaScript">
    function sendBack(value) {
    this.opener.document.main.EMP1.value = value;
    this.close();
    </script>

    <a href="javascript:sendBack('One')">One</a>

    The parent has form name="main" and target input type="text" name="EMP1"

    but it's not working

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

    Default

    You wouldn't use "this.opener", but "parent" instead, inside your script. For example:

    Code:
    <form id="testform">
    <input type="text" id="mybox" />
    </form>
    
    var googlewin=dhtmlwindow.open("googlebox", "iframe", "test.htm", "#1: Test", "width=590px,height=350px,resize=1,scrolling=1,center=1", "recal")
    Here's the source for "test.htm":

    Code:
    <script type="text/javascript">
    
    function postback(thevalue){
    parent.document.getElementById("mybox").value=thevalue
    }
    
    </script>
    
    <form>
    <input type="text" id="test" /> <input type="button" value="Save" onClick="postback(document.getElementById('test').value)" />
    </form>

  4. #4
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thankyou

    That was it! Now works like a charm. Thanks so much.
    OK now looking around to see how to close the DHTML widget window.close is not supported

  5. #5
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Everything is going great with widget

    This works:
    Code:
    <input type="button" value="CLOSE" name="exit" onClick="javascript:parent.closeit()">

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
  •