Change to showModalDialog?

Posted on 2006-04-08
Last Modified: 2010-07-27
Use a spelling app that opens using, checks and help correct the spelling in a text box and then closes.  Want to be able to change how this opens, from a link to a showModalDialog link.  Is this possible?

Current code:

<textarea name="MyTextArea" cols="50" rows="7" id="MyTextArea">Ths iz a tezt sampl. </textarea>
<a title="Spell Check" href="#"  onClick="'/ASPSpellCheck/ASPSpellCheck.asp?fields=MyTextArea','aspSpellWin','width=460, height=290, scrollbars=no');return false;" ><img src="/ASPSpellCheck/Assets/spellicon.gif" style="cursor:pointer"   alt="Spell Check" border="0" ></a>

Had a go at using showModalDialog, the window opens but hangs. Presume that there is an parameter that is not being passed:
<textarea name="MyTextArea" cols="50" rows="7" id="MyTextArea">Ths iz a tezt sampl. </textarea>
<a title="Spell Check" href="#"  onClick="window.showModalDialog('/ASPSpellCheck/ASPSpellCheck.asp?fields=MyTextArea','aspSpellWin','dialogWidth:460px;dialogHeight:290px');" ><img src="/ASPSpellCheck/Assets/spellicon.gif" style="cursor:pointer"   alt="Spell Check" border="0" ></a>

Anyone got any ideas?
Question by:daimo1
    LVL 3

    Expert Comment

    First question before I move forward on this: do you intend for people using browsers other than Internet Explorer to use your web page?  If so, then showModalDialog is not for you, as it is a feature implemented only by Microsoft browsers, and is the function you should use.

    Author Comment

    Hi Kyanar

    Happy with IE only.  

    LVL 3

    Accepted Solution

    OK, first things first, you do not need that second parameter - unlike in, that is the special dialog parameters to hand to the javascript of the popup (for future reference when using window.showModalDialog)

    Second up, modal dialogs don't have as much access to the DOM and API as a regular popup does.  First thing I note is that the ASP spell check system has a "Processing" wait screen while it works, then it redirects you off to it's actual scripts to perform the spell check.  Unfortunately, a dialog opened with showModalDialog is not actually allowed to do this, probably due to the risk of XSS exploits making it too dangerous to allow.

    So, regretfully, I must inform you that what you are attempting to do is not possible with the showModalDialog method (I tore my hair out attempting to do this with a complex online data entry application - eventually gave up and removed all showModalDialog references from the script)

    Author Comment

    Not what I wanted to hear but at least i won't waste anymore time trying.

    Thanks for you help Kyanar.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    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!

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Building “do-it-yourself” web sites has become an epidemic. There are so many blogs, web sites and even books that "teach" you how to build your web site in a few extremely simple and easy steps. Building a web site has become easier than boiling an…
    The viewer will learn how to dynamically set the form action using jQuery.
    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.

    794 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

    17 Experts available now in Live!

    Get 1:1 Help Now