Solved

Display Box syntax

Posted on 2003-11-06
11
272 Views
Last Modified: 2010-04-09
Hi,
       I am new to HTML. I need to display some rows which have been retrieved from the database on the front-end. For this I need to use a scroll enabled display box with the scroll bars enabled but text input disabled(meaning the user shouldnot be able to enter or edit the rows displayed, they are strictly for viewing). How do I go on to do this?
0
Comment
Question by:medebayan
[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
  • 3
  • 2
  • 2
  • +4
11 Comments
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9699025
Hi,
load your results into the following:
<textarea name='theResults' id='theResults' rows=10 cols=40 onfocus=this.blur()></textarea>

Vinny
0
 
LVL 5

Expert Comment

by:ho_alan
ID: 9699108
suppose u're using asp.

<%
result = ........
%>

<textarea readonly><%=result%></textarea>
0
 
LVL 17

Expert Comment

by:dorward
ID: 9699487
Rather then using an input control and trying to prevent the user inputing anything....

<div style="width: 45em; height: 18em; overflow: scroll;">

<!--
whatever HTML you like... so long as it can go in a <div> normally
You can have a <table> if you like.
-->

</div>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:prashantuchil
ID: 9700367
hi,

Does adding a readonly attribute to ur textarea solve the problem ....

like <textarea name='theResults' id='theResults' rows=4 cols=40 readonly>
0
 
LVL 35

Expert Comment

by:YZlat
ID: 9701059
you'll have to use ASP to pull up info from database.



0
 
LVL 8

Expert Comment

by:klykken
ID: 9704148
Hi medebayan,
There are already HTML attributes made for this.

You can use:
<textarea name='theResults' id='theResults' rows=4 cols=40 readonly>
-or-
<textarea name='theResults' id='theResults' rows=4 cols=40 disabled>

readonly:
-receive focus but cannot be modified by the user.
-are included in tabbing navigation.

disabled:
-do not receive focus.
-are skipped in tabbing navigation.

-klykken
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9705936
onfocus=this.blur()

Don't use this, please. Use readonly or disabled.

Another solution would be to place the data retrieval/display code in a separate .asp page and then include that page into the main page using an iframe.

<iframe width="250" height="400" src="data.asp"></iframe>

To locak the iframe frame in place, you can use CSS positioning or put the iframe tag inside a table cell.
0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9708215
>>onfocus=this.blur()
>>Don't use this, please. Use readonly or disabled.

Why? Has the code suddenly become inoperable?  Are they being deprecated?  Or, is it because it is not an "approved" coding practice? Or, perhaps because the code works with all browsers -- even the 'standards-compliant' ones whereas 'readonly and disabled' only work with version 5+ browsers

Vinny
0
 
LVL 8

Accepted Solution

by:
klykken earned 125 total points
ID: 9708561
Vincent,
The reason disabled or readonly are 'better' to use is first of all because that is the proper way of doing this in HTML. It's been so since HTML4 was a final recommendation in '97. For all the users that have javascript turned off, this javascript function will not work. Now, you could argue that very few people turn off their javascript, just as one could argue that very few users have browsers in the 4 generation or below. But taken the question is asked in the HTML forum and that HTML actually have attributes created for this, the 'standard compliant' way of coding this would be to use the appropiate attributes.

-klykken
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9708594
Vincent, consider what onfocus="this.blur();" does if you're trying to use the keyboard to navigate.
0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9710266
Hi kylkken,

>>But taken the question is asked in the HTML forum...

  True.

Vinny
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with mod_substitute 18 76
alert on input text 2 40
need help with share buttons 11 106
Embedd an image or live dashboard into Slack 1 53
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

734 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