Solved

Allow selecting text in modal dialog

Posted on 2006-06-11
12
366 Views
Last Modified: 2008-02-01
Hi

I have a window which is popped up by window.showModalDialog() method.  My users want to copy some text in this dialog window and then paste in another window after closing the dialog.  However the modal dialog window does not allow users to select text content using mouse cursor.
 
Is this a limitation of dialog window?  Any work around?
0
Comment
Question by:Edwin_C
  • 6
  • 5
12 Comments
 
LVL 3

Expert Comment

by:a122178
ID: 16883474
Can you implement a "Select All" button to solve the problem?
0
 
LVL 16

Author Comment

by:Edwin_C
ID: 16883491
"Select All" (pressing Ctrl-A) does not work.  Moreover the users need selecting some text but not all.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16883986
Here a workaround: http:Q_21581323.html
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16884016
You can even have  a <textarea> with no borders:
<textarea style="border:0px; width: 100%; height:100%; overflow:hidden;">
Here some text
</textarea>



0
 
LVL 16

Author Comment

by:Edwin_C
ID: 16884144
Hi Zvonko

Thank you for your reply.  Actually the modalDialog is a ASP.NET WebForm and its content is generated by my .NET code using a DataGrid ASP.NET control.  I think the details of .NET is not important here but I just cannot put my ASP.NET DataGrid control inside <textarea> tag because ASP.NET will not recognize them as code.  Is using textarea tag the only way to do it?  Can I use DIV or something to achieve the same result?

Edwin
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16884769
It the referenced answer there is the option to set the div to style editable area. Try that.
0
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!

 
LVL 16

Author Comment

by:Edwin_C
ID: 16890830
Sorry! I can't follow.  In the referenced answer http:Q_21581323.html, only <textarea> is used to surround the text.  I cannot find mentioning <div>.  Have I missed something?

0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 16892547
Sorry, it seams I have read it in a simelar question.
But it goeas like this:

<html>
<head>
<title>Zvonko &#42;</title>
</head>
<body>
<h1>This Header NOT selectable</h1>
<div contentEditable>
<h1>But this one is selectable</h1>
And all following text in the DIV
</div>
</body>
</html>




0
 
LVL 16

Author Comment

by:Edwin_C
ID: 16892792
Amazing!  I have never thought about having this attribute.  Now users can select the text content but they can also modify the content which is some what undesirable.  The best thing to have is to allow them to select some text (then they press ctrl-C) but not allowing them to change the content.  Any more ideas?
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16892897
The question is: Why it has to be Modal at all?
0
 
LVL 16

Author Comment

by:Edwin_C
ID: 16892971
Because it is a screen for users to make selection.  I don't want the users to switch to other screen until they make their choices or close the parent screen leaving the selection screen open or go back to the parent screen and then open multiple selection screens.  
0
 
LVL 16

Author Comment

by:Edwin_C
ID: 16908381
Zvonko
Thank you for your solution.  It is a viable solution to the problem althought it has its side effect.
Edwin
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 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

20 Experts available now in Live!

Get 1:1 Help Now