Solved

Prevent form field from being modified

Posted on 1997-07-09
1
231 Views
Last Modified: 2006-11-17
I'm relatively new to Javascript, and I've managed to create a "calculator". The thing though is that the only method I know of to display results is in a TEXT field in a FORM. My problem is that it is possible for the user to go into these text fields and edit the results (for whatever reason) and may cause some confusion. So I would like to know if there is a way to prevent the field from being modified (no, not willing to do something like send the values to the fields every half a second). If not, then is there any other way to display answers in an object other than a text field in a form?? If you would like clarification of what I'm talking about look at it at: http://courses.bus.ualberta.ca/mgtsc352/2_5_clc6.htm 
The only thing the user is supposed to modify is the field beside "SMOOTH".  Thank you!
0
Comment
Question by:leekk
1 Comment
 
LVL 5

Accepted Solution

by:
icd earned 70 total points
ID: 1268395
Change each of the input boxes that you calculate to (for example)

<td><input type="text" name="f2" size=4 OnBlur="compute(this.form)"></td>

Then as soon as the cursor is moved off the field any changes are recomputed.

Of course it will not change it back until the cursor moves off the field but then no other solution will either.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
how can i get the string decoded ? 2 28
asp.net open new page without popup blocker 8 19
Search Item in Table 2 22
Why is initialize not a function? 8 22
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

837 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