Solved

Allow selecting text in modal dialog

Posted on 2006-06-11
12
373 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
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

689 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