473,568 Members | 2,986 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1770
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" onpropertychang e="BodyInput.va lue =
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.c om> 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" onpropertychang e="BodyInput.va lue =
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
2490
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 the latency with which the data loads to the browser, whether drop down boxes are viable for providing a large number of select options. I've put...
4
516
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 of Jaws can read group boxes with an earlier MFC application that we wrote. Is this by design or is there a setting I can change to fix this. I have...
2
1706
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 drop down box with all the types listed and simple the ability to click on multiple check boxes to show what class(es) of license the person has. I...
8
2551
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 courses are populated. When course is selected, lists of occurrences, groups and
1
2273
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 that opens, closes and is assigned to the Issue. These come from the same group of users, so they are all related to a "Users" table. I have three...
5
2208
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. The row source for combo2 is: SELECT DISTINCT tblComplaintCategory.fldComplaintCategory, tblComplaintCategory.fldComplaintCategoryID,...
1
2901
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 main form (RD Form) with 4 combo boxes (i.e. cbo1, cbo2, etc) and a subdatasheet (the subform...let's call it subInfo) below the combo boxes on...
0
2574
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 problem... My datagrid displays 2 columns of checkboxes and allows the user to select the check boxes and sort the datagrid. My first problem, if
1
1961
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
1593
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 contents and I have used those methods on "form view" forms, but they don't lend themselves to datasheet forms. One thing, of course, is to set the...
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7665
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.