?
Solved

Allow selecting text in modal dialog

Posted on 2006-06-11
12
Medium Priority
?
387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

770 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