Questions tagged [hidden-field]

An HTML Input element that users do not see or interact with. It can hold a value and is often used to store client-side variables.

As defined from w3.org:

An INPUT element with `TYPE=HIDDEN' represents a hidden field. The user does not interact with this field; instead, the VALUE attribute specifies the value of the field. The NAME and VALUE attributes are required.

For example:

<input type=hidden name=context value="l2k3j4l2k3j4l2k3j4lk23">

This element is available in the following versions of HTML:

  • HTML 3.2
  • HTML 4.0
  • HTML 5
  • XHTML 1.0

It is important to note that users are able to see the hidden values if they view the source of the page. Hidden fields should never be used to store sensitive information like passwords or credit card information. A good programming guideline is to only use the hidden field to store information that the page has generated or information the user would not know or understand.

913 questions
7
votes
5 answers

ViewState or HiddenField

If I have a simple piece of data to store (an integer or string for example) I might choose to store that in ViewState, or using a HiddenField control. Why would I choose one over the other? ViewState Hard for the user to decode (thought not…
Richard Ev
  • 48,781
  • 54
  • 181
  • 273
7
votes
3 answers

ASP.NET MVC 3 HiddenFor Javascript

I have two hidden input fields in my form: I am assigning their value by doing the following: document.getElementById('lat').value =…
Subby
  • 4,819
  • 14
  • 66
  • 122
6
votes
2 answers

Hide a field from a django modelform

The django documentation suggests I can identify hidden / visible fields from within my template. I have two models, AddressInfo and PharmacyInfo. I need to enter data for both tables from a single page. I want to hide the address_id field (from the…
Aidan Ewen
  • 11,754
  • 8
  • 57
  • 80
6
votes
7 answers

What is encapsulation? How does it actually hide data?

Searching turns up a simple definition: data hiding. But, consider the following two examples: 1) First Example: Class Employee { public int age; } 2) Second Example: Class Employee { private int age; public int getAge(){return…
Anil Purswani
  • 1,757
  • 6
  • 28
  • 60
6
votes
3 answers

Rails : How to assign name and id to hidden_field_tag?

How to assign specific id and name to hidden_field_tag ? Like this, hidden_field_tag(:id => "page_no",:name => "page", :value => "1" ) Any Idea!
krunal shah
  • 15,347
  • 24
  • 90
  • 136
6
votes
4 answers

Is the use of hidden fields in forms insecure?

For example Imagine I have the following form <%= form_for(@comment) do |f| %> <%= f.hidden_field :user_id%> <%= f.hidden_field :article_id%> <%= f.label :content %>
<%= f.text_area :content %> <%= f.submit %> <% end…
David R
  • 63
  • 3
6
votes
2 answers

ASP.NET MVC 2 and lists as Hidden values?

Hi, I have a View class that contains a list, this list explains the available files that the user have uploaded (rendered with an html helper). To maintain this data on submit I have added the following to the view : <%: Html.HiddenFor(model =>…
Banshee
  • 15,434
  • 36
  • 111
  • 198
6
votes
2 answers

How to hide form fields in twig template?

I have a Symfony form that includes two TextType fields. If a certain check evaluates to false, I don't want to display the input fields but output the static content of the field and include the form fields as hidden fields instead. How can I do…
Gottlieb Notschnabel
  • 8,768
  • 17
  • 66
  • 107
6
votes
7 answers

Does form with enctype="multipart/form-data" cause problems accessing a hidden field

I have created a hidden form element
//rest…
Ankur
  • 47,089
  • 107
  • 237
  • 309
6
votes
2 answers

How to prevent google chrome from caching my inputs, esp hidden ones when user click back?

i have an asp.net mvc app which have quite a few hidden inputs to keep values around and formatting their names so that i can use the Model binding later when i submit the form. i stumble into a weird bug with chrome which i don't have with IE or…
melaos
  • 8,204
  • 3
  • 54
  • 91
6
votes
1 answer

Inserting a column with hidden field in gridview

I need to insert a column with hidden field in grid view. The user should not know that one column is there. I tried the following: created a css class width display:none; and assigned ItemStyle-CssClass="MyCssClass". But result is not…
sujeesh
  • 488
  • 2
  • 7
  • 15
6
votes
1 answer

Setting hidden field value with Jquery $('#id').attr("value", 'val'); not working in IE

I noticed that IE doesnt fill the value of a hidden field, using the code below, while Chrome and FF have no problem with this. $('#id').attr("value", 'val'); I tried a few other things like .setAttribute or .val() = "val";
TrustMe
  • 95
  • 1
  • 2
  • 6
6
votes
4 answers

change field value when select radio buttons

I want to change the value of hidden input field when radio buttons selected : 10
45
datisdesign
  • 3,005
  • 7
  • 25
  • 29
5
votes
2 answers

What are Oracle hidden fields?

ALL_TAB_COLS differs from ALL_TAB_COLUMNS in that hidden columns are not filtered out. What are hidden fields? This view differs from "ALL_TAB_COLUMNS" in that hidden columns are not filtered out.
Oh Chin Boon
  • 21,393
  • 45
  • 133
  • 208
5
votes
1 answer

MVC @Html.HiddenFor renders html form with no value

Caution, before You read the rest This question is not about POST method, redisplaying view with submited form or binding input values to controller method parameters. It's purely about rendering the View using html helper (HiddenFor or Hidden -…
Przemysław
  • 206
  • 1
  • 6