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.

946 questions
8
votes
1 answer

Does jQuery's `click()` method work on hidden form elements?

Or, asked another way, do hidden form elements () support jQuery's click() method?
Jeromy French
  • 11,812
  • 19
  • 76
  • 129
7
votes
1 answer

Pass an JavaScript object to a HIDDEN input field, and catch it as an array/object on the Server-Side

I have a field on my page, like this: and I have a piece of code that looks like this: $(document).ready(function() { var myObject = { item1: 'item1 value', item2: 'item2…
user798596
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
  • 52,939
  • 59
  • 191
  • 278
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
  • 5,370
  • 15
  • 70
  • 125
7
votes
2 answers

Hidden input for Dictionary in ASP.NET MVC 3

I need to get my model properties in Post action, so need to hidden element for them, but I have a problem with type of Dictionary . this is My model: public class ViewModel{ ... public ViewPart ViewPart { get; set; } } public…
user1479279
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
  • 13,049
  • 8
  • 63
  • 88
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,857
  • 6
  • 35
  • 63
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
  • 16,089
  • 25
  • 97
  • 143
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,376
  • 38
  • 128
  • 219
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
  • 50,282
  • 110
  • 242
  • 312
6
votes
2 answers

How to set and get Boolean value from a asp.net hidden field

I have a hidden field. Where I need to set a Boolean value intitially. After some operation I need to update the hidden filed value using JavaScript. But we can only store string value in hidden field. How to set/get Boolean value in hidden…
user1926138
  • 1,464
  • 7
  • 34
  • 53
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,386
  • 4
  • 56
  • 93
6
votes
1 answer

Rails: Hidden fields not passing values

I am trying to create a form for a site administrator to associate events with a list of previous speakers. The administrator navigates to the speaker, clicks on a button to "Add to event" and a form comes up asking for which event the speaker is…
jstein
  • 633
  • 1
  • 8
  • 14
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