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
14
votes
1 answer

simple_fields_for not showing up [rails 4]

Im trying to create two hidden fields, and one shows up no problem, but the other that comes from the nested form does not product.rb class Product < ActiveRecord::Base has_many :product_options, dependent: :destroy …
tallgirltaadaa
  • 1,864
  • 15
  • 26
11
votes
3 answers

How to pass a hidden value in a form in Spring MVC 3.0?

How to pass a hidden value in a form in Spring MVC 3.0 I am not able to assign a value to a hidden field using . How can I set the value of the test field and access it on the server side. thanks
Santhosh S
  • 1,083
  • 5
  • 20
  • 40
11
votes
3 answers

Selenium WebDriver clicking on hidden element

Hi I would like to know how to click on hidden element and/or disable element by using Selenium WebDriver. I know with selenium 1 I can do this as below: selenium.click(id="idOfHiddenField"); and this would work, but with selenium 2 (WebDriver),…
10
votes
4 answers

Post newline/carriage return as hidden field value

I need to post multi-line data via a hidden field. The data will be viewed in a textarea after post. How can I post a newline/carriage return in the html form? I've tried \r\n but that just posts the actual "\r\n" data
Adam
10
votes
3 answers

Hidden value assigned in js lost after postback

Here's my problem. I have a hidden field whose value I change through a javascript method. The problem is after postback the value is lost. How can I persist the value after postback? Thanks! .aspx File
Gonzalo
  • 930
  • 6
  • 22
  • 34
10
votes
2 answers

Rails: Hidden field in form_for is not sending parameters to controller

I have a form_for I'm making in my view helper that is going to let one user promote another user from a group. def promote_button_for(group, user) membership = group.get_membership( user ) form_for membership, :url =>…
Andrej
  • 237
  • 1
  • 3
  • 8
10
votes
2 answers

Representing booleans in hidden fields

Is there a recommended way to represent booleans in HTML form hidden fields? Is it usually a matter of existence, or should one use 1/0 or "true"/"false" strings?
Yarin
  • 144,097
  • 139
  • 361
  • 489
10
votes
2 answers

Rails3 hidden_field in haml

I use rails and haml, haml-rails. How I create hidden_field in haml? I have field: .field = f.label :submit_date = f.datetime_select :submit_date I will hide this field. User not able to modify datetime manualy. I will store in db datetime when…
esio
  • 1,402
  • 3
  • 15
  • 28
9
votes
1 answer

(How) can I tell if my form field is hidden in Django template

I have a Django model formset, and some fields have hidden inputs. I am trying to generate the headings from the first item in the formset with formset.visible_fields. This works. {% for myfield in formset.0.visible_fields %} …
wobbily_col
  • 9,246
  • 10
  • 51
  • 75
9
votes
3 answers

ASP.NET MVC - Secure Temporary Storage of Credit Card Data

I have a checkout process for a shopping cart that is currently storing credit card data in the session for retrieval once the user finalizes the purchase. The purchase process is set up such that the user inputs the credit card, views a…
Nathan Taylor
  • 23,720
  • 17
  • 90
  • 152
8
votes
2 answers

Set hidden input value in Selenium?

We have hidden input fields on our form and we need Selenium to set the value of those fields. What is the best way to set the value of hidden inputs via Selenium IDE?
Sixty4Bit
  • 11,052
  • 13
  • 43
  • 58
8
votes
2 answers

HiddenField.ValueChanged Event not firing when changed from Javascript

UPDATE I moved the Javascript to the ASPX site instead, and added a postback function for it. Now it works. Thanks to @orgtigger and especially @lucidgold for spending their time helping me! Here is the update code that works!
Joe
  • 83
  • 1
  • 1
  • 6
8
votes
4 answers

Javascript best practices - Using server-side values

For the past few years I have always used a client-side hidden field to store a server-side value and use it in Javascript land. For example, let's say I need an Ajax timeout value from my app configuration. I'd probably store it like…
wild_nothing
  • 2,299
  • 28
  • 44
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,372
  • 13
  • 67
  • 119
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
1 2
3
60 61