Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:13:24+00:00 2026-05-26T03:13:24+00:00

At present, when I wish to display a dialog to a user, say to

  • 0

At present, when I wish to display a dialog to a user, say to edit an object that’s been selected from the main window, I create a jQueryUI Dialog and insert an iframe inside of it to the page that handles the editing.

I’ve found this works very well because the dialog page can have its own scripts,styles, and element IDs. I don’t need to concern myself with any conflicts that could arise between my dialog and the parent page.

The only somewhat awkward part I’ve found is communication between the parent window and the child dialog. Unfortunately the child iframe usually needs to know about its parent. I’ve found this necessary so it can do things like closing its dialog (which resides in the parent window) or telling the parent to refresh its list of items after a successful edit.

Ideally the child wouldn’t be aware of its parent, but the benefits of a standalone page, that can be tested like any other with no conflicts seems worth it.

Still, I often read comments discouraging iframe use. I’m not sure if this is truly not a best practice, or some people simply prefer not to use them.

I’m always looking to improve the way I do things though. If using ajax for this type of thing really is best practice, how is it done for a non trivial dialog?

I can imagine using ajax to request the markup for a dialog and inserting that into the dialog, but I can’t figure out how to manage all of the conflicts, scripts, css, element IDs, etc for a complex dialog merging w/ an existing page.

Are there any examples of how this should be done? Or is iframe really better when your dialogs are not very simple?

Thanks for any ideas or help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:13:24+00:00Added an answer on May 26, 2026 at 3:13 am

    One thing you could do is use the namespace pattern so you do not have any conflicts in your scripts.

    So you can have a namespaced object which contains all of your main page’s script to something like
    MyApp.MainController

    And similarly one for your dialog
    MyApp.DialogController

    As for making sure your jquery selectors do not collide (i.e. get all inputs just for the dialog instead of all of the inputs for the entire page) is to create a new namespaced object to contain the script for your dialog inside your main script and then pass in the dom context you want to scope your calls with. This is often done with javascript MVC pattern when constructing controllers

    var myDialogController = new MyApp.DialogController($("#my-dialog-container));
    

    Inside your namespaced dialog script you can use delegates when creating your scripts and scope them appropriately.

    myScope.delegate("input", "change", function(e){...})
    

    This says “only bind events for input elements which live inside the ‘myScope'” element.

    Finally for communication from your dialog to your main page you can use query triggers and trigger custom events on your scoped dialog element.

    myScope.trigger("myDialog.hasTriggeredEvent", dataToSendToMainPage);
    

    And in your main script you can listen for that event that was triggered

    ("body").live("myDialog.hasTriggeredEvent", function(e) {
        //do logic here
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page to edit user information, and I wish to show the
I wish to made available a functionality that searches in all pages and content
I wish to develop a client-server application in .NET that functions as follows: Clients
I have a complex table pulled from a multi-ActiveRecord object array. This listing is
I have string say ABC,D , now I wish to write a method append(initialStr,
I wish to create a property page where features/facilities are represented by icons (e.g.
I wish to block ALL my content from any users using an ad-blocking browser
Hi I wish to create dynamic file view gallery images but I have no
In a .NET 1.0 C# application, I wish to display a list of files
Preface: I'm developing an application that quizzes users on multiple topics. I wish to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.