www.webdeveloper.com
Results 1 to 6 of 6

Thread: Set different parent window

  1. #1
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    6

    Set different parent window

    Hi,

    I am trying to update a parent window with data from a child window.

    Now that doesn't sound so difficult, except for the fact that I am letting the visitor of my website choose from a selection list on the child page. Once the selection has been made, the child page automatically gets refreshed (also with javascript) so a subselection gets available.

    Now when my page gets refreshed I loose the reference of the parent page.

    Is it possible to retain this value somehow or te set is again somehow with data I have posted?

    Many thanks,

    Francis.

  2. #2
    Join Date
    Mar 2010
    Posts
    2,803
    [QUOTE]
    Quote Originally Posted by funzoh View Post

    Is it possible to retain this value somehow or te set is again somehow with data I have posted?
    quote]
    I am assuming that some form information from the child window is being sent to a server side script, some number crunching then happens and you then want to display the results back in the parent window.

    If that is so, another and imo easier approach would be to display the child window in the parent window (I'm not sure why you need 2 windows in the first place) and when the server side script has completed its number crunching it can then redirect back to the url of whatever was in the parent window originally and the latest information from the database should then be displayed.

  3. #3
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    6
    Hi Tirna,

    Thanks for your reply.

    I am creating a lookup button on which my visitors need to click to lookup some value from a database. The visitor needs to make a category selection which narrows down the list to a subselection from which they can choose. E.g. If you make a database with postal codes. They first need to select the state. The child window sends the data to the server and receives all zip codes in that state from which the visitor can select (also within the child window). When the visitor selects a zip-code, it returns its value to the parent window.

    To be able to do so, I need to post the selected (first) in the child window, which refreshes the child window and which causes the parent setting to be reset.

    I would like to accomplish this because else I would be forced to refill a lot of form data in the parent window which the user has entered earlier (like eg name, street, phone, and lots more). It also gets more complicated because I would have to lookup data from 2 different databases which require seperate database connections at one time. By splitting this functionality to a parent-child setup, it eases up the work a lot and it would make my site much easier to maintain.

    Greetings, Funzoh.

  4. #4
    Join Date
    Mar 2010
    Posts
    2,803
    Ok I think what you want is becoming clearer but if I understand you correctly in your example you would have a select list of states with a select list of zip codes with initially no options for zip codes until the user selects a state in the first select list.

    If that is so, you can have both select lists on the one page with the states select list populated with the states and the zip codes select list initially empty.

    When the user selects a state, the select lists onChange event handler can send an ajax request to the server to get the zip codes for that state and send them back to the client browser to populate the zip codes select list.

    Then the selected state, zip code and other form data can be sent to a server side script for processing when submit is clicked.

    This way you only need one window.

    Am I still misunderstanding what you want?

  5. #5
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    6
    Whow, that even sounds better than what I was hoping to do with that second window!
    I think you have just helped me on the right tracks again. I will try this out today.

    Many Thanks!

  6. #6
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    6

    resolved

    Yep, that really did the trick for me. I have to say I am a bit new in Javascript and Ajax as you can see, but I am always keen to learning new stuff and I must say this opens up a new world for me.

    Many thanks Tirna!

    Greetings,

    Francis.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles