hidden-fields

Passing an array through a hidden_field_tag in Rails

南笙酒味 提交于 2021-02-06 08:58:49
问题 I did find this question on SO, but it didn't help, really. So, I'd like to pass an array through a hidden field tag. As of now my code is: <%= hidden_field_tag "article_ids", @articles.map(&:id) %> This obviously does not work since it passes the ids as a string. How do i do it? 回答1: Hi maybe there is better solution but you may try <% @articles.map(&:id).each do |id| %> <%= hidden_field_tag "article_ids[]", id %> <% end %> 回答2: The following worked for me on Rails 4.1.10 <% @your_array.map(

Passing an array through a hidden_field_tag in Rails

允我心安 提交于 2021-02-06 08:58:33
问题 I did find this question on SO, but it didn't help, really. So, I'd like to pass an array through a hidden field tag. As of now my code is: <%= hidden_field_tag "article_ids", @articles.map(&:id) %> This obviously does not work since it passes the ids as a string. How do i do it? 回答1: Hi maybe there is better solution but you may try <% @articles.map(&:id).each do |id| %> <%= hidden_field_tag "article_ids[]", id %> <% end %> 回答2: The following worked for me on Rails 4.1.10 <% @your_array.map(

Chrome doesn't cache hidden form field values for use in browser history

允我心安 提交于 2020-01-10 17:59:28
问题 I have a ASP.Net web form that contains both text box fields and hidden fields. The hidden field values are modified dynamically using client side JavaScript. Posting the form, inspecting the values and redirecting to another page is all working as expected. However, when I use the browser back button to display the previous page then I expect so see that ALL form fields are still populated with the values that were posted. In IE and Firefox this is the case for both text and hidden input

Web security, are there issues with hidden fields (no sensitive data)?

℡╲_俬逩灬. 提交于 2019-12-20 17:52:10
问题 I was having a discussion with coworkers. We have to implement some security standards. We know not to store 'sensitive, addresses, date of birth' information in hidden fields but is it OK to use hidden fields for your application, in general. For example: action=goback It seems like it would be safer to use hidden fields for that kind of information as opposed to adding it in the query string. It is one less piece of information that a hacker could use against your application. 回答1: A hacker

Why are hidden fields used?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 10:28:58
问题 I have always seen a lot of hidden fields used in web applications. I have worked with code which is written to use a lot of hidden fields and the data values from the visible fields sent back and forth to them. Though I fail to understand why the hidden fields are used. I can almost always think of ways to resolve the same problem without the use of hidden fields. How do hidden fields help in design? Can anyone tell me what exactly is the advantage that hidden fields provide? Why are hidden

jquery validator - Validating visible elements only

时间秒杀一切 提交于 2019-12-12 07:15:44
问题 I have a radiobutton that hides/shows a div. All visible elements are "required", but adding ignore: ":hidden" after the validation rules, doesn't work... Here's the code: <script type="text/javascript"> $(document).ready(function(){ $("#myForm").validate({ rules: { name: "required", age: "required", height: "required", ignore: ":hidden" } }) }); </script> </head> <body> <form id="myForm" name="myForm" method="post" action="" > <input type="radio" name="checkAge" value="adult" onclick="$('

Web security, are there issues with hidden fields (no sensitive data)?

谁说胖子不能爱 提交于 2019-12-03 05:18:15
I was having a discussion with coworkers. We have to implement some security standards. We know not to store 'sensitive, addresses, date of birth' information in hidden fields but is it OK to use hidden fields for your application, in general. For example: action=goback It seems like it would be safer to use hidden fields for that kind of information as opposed to adding it in the query string. It is one less piece of information that a hacker could use against your application. A hacker can access hidden fields just as easily as querystring values by using an intercepting proxy (or any number

Why are hidden fields used?

此生再无相见时 提交于 2019-12-02 22:43:56
I have always seen a lot of hidden fields used in web applications. I have worked with code which is written to use a lot of hidden fields and the data values from the visible fields sent back and forth to them. Though I fail to understand why the hidden fields are used. I can almost always think of ways to resolve the same problem without the use of hidden fields. How do hidden fields help in design? Can anyone tell me what exactly is the advantage that hidden fields provide? Why are hidden fields used? Hidden fields is just the easiest way, that is why they are used quite a bit. Alternatives

jquery validator - Validating visible elements only

时光总嘲笑我的痴心妄想 提交于 2019-11-30 15:08:26
I have a radiobutton that hides/shows a div. All visible elements are "required", but adding ignore: ":hidden" after the validation rules, doesn't work... Here's the code: <script type="text/javascript"> $(document).ready(function(){ $("#myForm").validate({ rules: { name: "required", age: "required", height: "required", ignore: ":hidden" } }) }); </script> </head> <body> <form id="myForm" name="myForm" method="post" action="" > <input type="radio" name="checkAge" value="adult" onclick="$('#minorRequisites').hide();" />Adult<br/> <input type="radio" name="checkAge" value="minor" onclick="$('

Chrome doesn't cache hidden form field values for use in browser history

人盡茶涼 提交于 2019-11-30 11:25:45
I have a ASP.Net web form that contains both text box fields and hidden fields. The hidden field values are modified dynamically using client side JavaScript. Posting the form, inspecting the values and redirecting to another page is all working as expected. However, when I use the browser back button to display the previous page then I expect so see that ALL form fields are still populated with the values that were posted. In IE and Firefox this is the case for both text and hidden input fields. In Chrome this is ONLY the case for text fields. The value of hidden fields is lost. Is it true