ShowModal Dialog Question

Posted on 2011-10-06
Last Modified: 2012-05-12
I am opening the ShowModalWindow using Classic javascript.

I have a form inside that window.

one is cancel and other is submit buttons of that form..

I want to do close the modalwindow on click of cancel and if i click submit, it should save the data and return me the alert message and close close the window.

Cab anyone Javascript master Guide me

Question by:myselfrandhawa
    LVL 16

    Expert Comment

    by:Easwaran Paramasivam
    To close the window write window.close();

    Have a Hiddden field, if the submit is succeeded then set some Flag for it. In the window.onbeforeunload() method write a function and check the flag there. If the flag is set (successfully submitted) then show an alert message.

    One more option there. From pop-up page to parent page you can send some RETURN values. Based on the return value, you can show the alert message in Parent page.
    LVL 75

    Accepted Solution

    If you need to submit a form in a modaldialog, try using an iframe and target the form to that.
    If it submits to same server, you can return a script that alerts and does a window.close()
    LVL 15

    Author Comment

    yes the way i am doing you said mplungjan, but the issue is when i click the close button, it shows me iheight issue!

    can you tel me why
    LVL 75

    Expert Comment

    by:Michel Plungjan
    What issue?
    LVL 15

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
    JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now