Free 30 Day Trial Additionally, you can set various restrictions using simple data-attributes or settings in js. your coworkers to find and share information. Does anyone know if it's possible to pass a hidden request parameter in with a A select list has both a value that is displayed to the user and a value that is passed back to the server in the form post. Please check and suggest me answer – Divyang Oct 8 '13 at 19:17 Its just binding a function to the select's onchange event and parsing the json from a custom data-attribute.Main benefit of this is that it should, in theory, let you post a 'variable amount of variables' from the form. Featured on Meta By using our site, you acknowledge that you have read and understand our The value is retrieved in this order - the An object that contains the HTML attributes to set for the element.An input element whose type attribute is set to "hidden".Returns a hidden input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes.The value of the hidden input element.

Stack Overflow for Teams is a private, secure spot for you and The value is retrieved in this order - the An input element whose type attribute is set to "hidden".Returns a hidden input element by using the specified HTML helper and the name of the form field.An input element whose type attribute is set to "hidden". site design / logo © 2020 Stack Exchange Inc; user contributions licensed under 5. Definition and Usage. H idden fields are similar to text fields, with one very important difference! As long as you pass in valid JSON to the data-attribute of your choice. So you could use some sort of delimiter in the posted value to get both values sent back and then parse them at that point:But better yet would be to pass back an ID value which you could then use to know which item was selected from a database and also use it to look up the second related item:Here's an alternative solution assuming jQuery is available. I want to use a purely HTML solution.I think that your solution is much more powerful and more lightweight than creating a new table in the database to store the values.

Returns a hidden input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes. I will test this later on but may have some minor errors.You should be able to use this on any select element and have hidden inputs automatically populate inside another element; script should also guarantee these to be in the same form tag for you and having unique but grouped names via HTTP array.If you need to use a hidden field for each options of the select dropdown, you can set that value in your own attribute in tag, instead of setting it into hidden field.I'd like to just add, that if you are willing to use radio buttons instead of a dropdown selection, the following worked for me:Then in your views, you still retrieve data same as above:Thanks for contributing an answer to Stack Overflow! Please visit MSDN to know all the overloads of Hidden() method.
By clicking “Post Your Answer”, you agree to our To subscribe to this RSS feed, copy and paste this URL into your RSS reader. By the way my HTML code that I included in my question didn't get displayed, probably because I didn't format it correctly, so that's why it reads badly, sorry!When you generate your page, you know that foo should send you back foo and bar.

Does anyone know if it's possible to pass a hidden request parameter in with a