Creating a field that cannot be edited throuh the ui form itself

L

Lando Chez

Hi

I want to create fileds on my form that can not be manually edited
through the UI of the form. Instead the (visible) content is changed
through changes on other parts of the form.
e.g. making a selection from a list changes the content of the field
mentioned above.
I don't know the html code to create such a field on my form. Can
anyone help me out?

Regards
 
G

Grant Wagner

Lando Chez said:
Hi

I want to create fileds on my form that can not be manually edited
through the UI of the form. Instead the (visible) content is changed
through changes on other parts of the form.
e.g. making a selection from a list changes the content of the field
mentioned above.
I don't know the html code to create such a field on my form. Can
anyone help me out?

<form name="myForm">
<input type="text"
name="readonlyInput"
value="The value"
defaultvalue="The value"
readonly="readonly"
onchange="this.value=this.defaultValue;">
</form>

The real problem is that this still does not guarantee that the end-user
can not change the content of this input. As a result, you can NOT
depend on the value in this input when it reaches the server. For
example, if you are calculating a total price based on unit price times
the number of units, you should re-calculate that on the server, even if
you are putting it the above readonly input for the benefit of the
end-user.
 
M

Mick White

Lando said:
Hi

I want to create fileds on my form that can not be manually edited
through the UI of the form. Instead the (visible) content is changed
through changes on other parts of the form.
e.g. making a selection from a list changes the content of the field
mentioned above.
I don't know the html code to create such a field on my form. Can
anyone help me out?

Regards

<input readonly>

Mick
 
L

Lando Chez

Hi

Thank you for responding. Is it possible to show the content as a lable
instead of a visible textfield box? So actually showing the content as
if it is a normal text on a form?
 
R

RobB

Lando said:
Hi

Thank you for responding. Is it possible to show the content as a lable
instead of a visible textfield box? So actually showing the content as
if it is a normal text on a form?

<input...style="border-width:0;">
 
K

Kimmo Laine

Lando Chez said:
Hi

Thank you for responding. Is it possible to show the content as a lable
instead of a visible textfield box? So actually showing the content as
if it is a normal text on a form?



Here's one way:

<span id="fred_flintstone">old value</span>
<script>
document.getElementById("fred_flintstone").innerHTML = "here's the new
value";
</script>

Doing it like this, the span IS a normal text on the form, but you can
manipulate the contents of it via innerHTML.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top