Hidden input does not pass the value to the server

Active3 hr before
Viewed126 times

10 Answers


You cannot use double binding with hidden field. The solution is to use brackets :,<< input type="hidden" required ng-model="formData.userid" ng-init="formData.userid=uid" /> ,Any ideas how I can submit a hidden field populated by AngularJS?

You cannot use double binding with hidden field. The solution is to use brackets :

<input type="hidden" name="someData" value="{{data}}" /> {{data}}

Here is the solution using ng-value:

<input type="hidden" name="someData" ng-value="data" />
load more v

there isn't a value for the hidden input.


In your form script you have missed out the value="" from the hidden input. This is the reason why nothing is displaying on the second page.

value = ""

The server would set the value of the hidden input with the ID "postID" to the ID of the post in its database before sending the form to the user's browser and would use that information when the form is returned to know which database record to update with modified information. No scripting is needed in the content to handle this.,Even though the hidden input cannot be seen at all, its data is still submitted.,When submitted, the form data sent to the server will look something like this:

<input id="prodId" name="prodId" type="hidden" value="xm234jq">
load more v

The hidden value of type defines a form field that is never displayed to the user. The user cannot change the value of the field, or interact with it.,hidden fields are used programatically, to pass information about the current page to the server.,When the user submits the form, all of the data they have entered is sent, including the data stored invisibly in the hidden fields.

Code Example

<form action="myform.cgi">
   <input type="file" name="fileupload" value="fileupload" id="fileupload">
   <label for="fileupload"> Select a file to upload</label>
   <input type="hidden" id="ipaddr" name="ipaddr" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
   <input type="hidden" id="referer" name="referer" value="<?php echo $_SERVER['HTTP_REFERER']; ?>">
   <input type="submit" value="submit">

Hidden Field to pass data not visible to user,Password Field Similar to text field but date entered is not masked or shown as **,Text Field to enter any (short ) text usually upto 100 chars length

<input type="hidden" name="<Name of the field>" value="<Default value of the object>">
load more v

A hidden field let web developers include data that cannot be seen or modified by users when a form is submitted.,Note: While the value is not displayed to the user in the page's content, it is visible (and can be edited) using any browser's developer tools or "View Source" functionality. Do not use hidden inputs as a form of security!,A hidden field often stores what database record that needs to be updated when the form is submitted.

Definition and Usage


The <input type="hidden"> defines a hidden input field.

<input type="hidden">

 Pretag team - issue, fix, solve, resolve

Hidden field rules prevent tampering by caching the values of a session’s hidden inputs as they pass from the server to the client, and verifying that they remain unchanged when the client submits the form to its POST URL.,Hidden form inputs are often written into an HTML page by the web server when it serves that page to the client, and are not visible on the rendered web page. Because HTTP is essentially stateless, like cookies, hidden form inputs are one way that web applications can use to remember session data from one page request to the next (called “persistence”).,For example, to remember the price of a TV accessed from a secret sale URL previously requested that session, this form remembers the sale price, and will provide it again to the shopping cart application when the client submits the payment page:

Preventing tampering with hidden inputs


Unlike visible inputs, hidden field rules are for hidden parameters only, from <input type="hidden"> HTML tags. For information on constraining visible inputs, see Validating parameters (“input rules”).

<input type="hidden">
load more v

What is 'CodeProject'?,This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL), featuresstuff Competitions Conferences News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase CodeProject Stuff

.attr('type', 'hidden')
.attr('formControlName', 'selectedMessages')
.attr('ng-reflect-name', 'selectedMessages')
load more v

Burp will capture the request, which can then be edited before being forwarded to the server.,Now use the "Forward" button to send the request to the server.,Locate the value you wish to change in the hidden form field.

 Pretag team - issue, fix, solve, resolve

Other "hidden-server" queries related to "Hidden input does not pass the value to the server"