Solved

Prevent form field from being modified

Posted on 1997-07-09
1
229 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
More SharePoint App with Angular and Bootstrap 17 49
Need Help adding an array and loop to a React file 7 28
JavaScript let vs var 5 27
Javascript Form Change 5 23
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

810 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