473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Text boxes and read-only text

I'm wondering what standard/best practices are for the following scenario:

I have a page representing several fields for stored data. If the user has
sufficient access privileges, the page is rendered w/ read/write text boxes and
they can edit the various fields as needed. However, if the user doesn't have
sufficient privileges (i.e. view only), the page is rendered w/ the text boxes
set to read-only. However, this results in a rather clunky looking page, and
if there is more text in a box than can be rendered w/i the specified box
height, then the user must scroll. Further, when printing the page, the text
is clipped to the box.

So, my thought has been to re-design the page to use two different controls for
each text field: a text box for read/write, and a label (static text) for
read-only. My thought that it will result in a much cleaner view page, and
printing will be as expected. The negative is that there are then two controls
for each field, and I must hide/show the appropriate control depending on the
read-write/read-only status.

Is there a better way to do this that doesn't rely on two controls for each
control?

Thanks for any thoughts and insights.
Nov 18 '05 #1
2 1762
What is your browser base?

If you know that it is IE only..

check out contenteditable... basically it allows any html element to be
editable..
http://msdn.microsoft.com/library/de...nteditable.asp

so you could do
<div contenteditable="true">This text it editable</div>
for those that have read write..
then simply change the flag to false if it is readonly,

This means printing doesnt get cliped either.

To make it so that you can still reference input ins your code you can do

<div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
this.innerText;">This text it editable</div>
<input type="hidden" name="BodyInput" value="">

then you simple get the data from the this.BodyInput.value property on the
server.

Not sure if this is what you are after but it may give you ideas as to where
to go from here.

"Julie" <ju***@nospam.com> wrote in message
news:40***************@nospam.com...
I'm wondering what standard/best practices are for the following scenario:

I have a page representing several fields for stored data. If the user has sufficient access privileges, the page is rendered w/ read/write text boxes and they can edit the various fields as needed. However, if the user doesn't have sufficient privileges (i.e. view only), the page is rendered w/ the text boxes set to read-only. However, this results in a rather clunky looking page, and if there is more text in a box than can be rendered w/i the specified box
height, then the user must scroll. Further, when printing the page, the text is clipped to the box.

So, my thought has been to re-design the page to use two different controls for each text field: a text box for read/write, and a label (static text) for
read-only. My thought that it will result in a much cleaner view page, and printing will be as expected. The negative is that there are then two controls for each field, and I must hide/show the appropriate control depending on the read-write/read-only status.

Is there a better way to do this that doesn't rely on two controls for each control?

Thanks for any thoughts and insights.

Nov 18 '05 #2
Darren Clark wrote:

What is your browser base?

If you know that it is IE only..

check out contenteditable... basically it allows any html element to be
editable..
http://msdn.microsoft.com/library/de...nteditable.asp

so you could do
<div contenteditable="true">This text it editable</div>
for those that have read write..
then simply change the flag to false if it is readonly,

This means printing doesnt get cliped either.

To make it so that you can still reference input ins your code you can do

<div contenteditable="true" id="Body" onpropertychange="BodyInput.value =
this.innerText;">This text it editable</div>
<input type="hidden" name="BodyInput" value="">

then you simple get the data from the this.BodyInput.value property on the
server.

Not sure if this is what you are after but it may give you ideas as to where
to go from here.


Thanks for the link and info, I'll look into it.

And, yes, my target is IE.
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Leigh | last post by:
I am building a data entry application using Java servlets. I had hoped to use drop down boxes to provide the user with data entry selections pulled from a database, but am now questioning, given...
4
by: Bruce Wolfe | last post by:
We are developing an application using C#.net and we need to provide support for screen readers. Jaws works pretty good except that it can't read group box labels on dialog forms. The same version...
2
by: steve | last post by:
Hello, I am using ACCESS 2000 and am currently trying to make a database for a police department and they have several types of license classes. i.e A,B,C,D,E etc. What they have asked for is a...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
1
by: Young J. Putt | last post by:
I have what I thought was a relatively simple data situation that I can't seem to get working using ADO.NET datasets and data binding. I have an "Issues" table which records the UserID of the user...
5
by: consonanza | last post by:
I am working on a report filter form. It has 2 combo boxes (cmboSelectSubject and cmboSelectCategory) to select criteria. Selecting an entry in combo 1 restricts the options available in combo 2....
1
by: Dave | last post by:
Hello all, First I'd like to apologize...This post was meant to be put in my previous post, but I tried many times without success to reply within my previous post. Now here goes... I have a...
0
by: Scott | last post by:
Hello all and thanks in advance for any help you may be able to offer me. I am quite new to asp.net and am trying to work with a datagrid but am having some problems with it. Here's the...
1
by: DR | last post by:
What is the fastest possible xsl style sheet to add another <boxnode under <boxes? <foo> <car></car> <boxes> <box id="234" /> <box id="75" /> </boxes> </foo>
4
WyvsEyeView
by: WyvsEyeView | last post by:
I have a datasheet form in which one field is a combo box that will potentially contain hundreds of records. I've read about several methods of speeding up such combo boxes or limiting their initial...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.