• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 571
  • Last Modified:

how to freeze input field in html form

Hello,
    I have a simple form data as below:
      <td>
      <input type="text" name="account type" size="20" maxlength="40" value="some text" ><br>
      </td>

What should I add to the above code so that the text field is frozen or in other words non editable?
0
kavishshukla
Asked:
kavishshukla
1 Solution
 
BogoJokerCommented:
Hi kavishshukla,

readonly!
     <input type="text" name="account type" size="20" maxlength="40" value="some text" readonly><br>


Joe P
0
 
hongjunCommented:
try

<input type="text" name="account type" size="20" maxlength="40" value="some text" disabled ><br>
0
 
BogoJokerCommented:
Sure thing =)
Joe P
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
hongjunCommented:
or this
<input type="text" name="account type" size="20" maxlength="40" value="some text" onfocus="this.blur()"><br>
0
 
BogoJokerCommented:
Hehe hongjun those are all nice tricks but I think he was looking for readonly.
Those are all nice tricks and hacks =)
Joe P
0
 
RoonaanCommented:
Hi kavishshukla,

BogoJoker and hongjun are both right, although there is a slight difference between readonly="readonly" and disabled="disabled".

When you disable a textfield using "disable", then your field will NOT be submitted along with the form. When you use readonly="readonly" the field is just uneditable, but gets to be submitted along with your form.

-r-
0
 
BogoJokerCommented:
That and the appearence, good morning Roonaan, that is signal for me to go to bed, darn its late!!
Get back into the top 10 =)
G'nite yall
Joe P
0
 
Ivo StoykovCommented:
Hello kavishshukla,

add disabled between < and >, i.e.
<input type="text" name="account type" size="20" maxlength="40" value="some text" disabled>


HTH

I
0
 
hongjunCommented:
@BogoJoker

Congrats!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now