params

How to remove(hide) index from array in PHP. Using http_build_query

时光总嘲笑我的痴心妄想 提交于 2019-12-24 11:28:34
问题 How to pass an array as a url parameter ? I'm using http_build_query() , array_shift() and urldecode() . I have this array: $array = array( 'phone' => array('ios', 'android', 'windows') ); When i use http_build_query and urldecode will return: phone[0]=ios&phone[1]=android&phone[2]=windows When i use array_shift will return: 0=ios&1=android&2=windows I want to this: test.php?phone=ios&phone=android&phone=windows Please help me. How to remove(hide) index from array. Thanks in advance. 回答1:

button_to not passing correct id from params hash

我的梦境 提交于 2019-12-24 07:16:11
问题 The button_to is not passing the correct id to the line_item. In the log below you see the bike_id change from the correct '86' to the incorrect '1' (which coincidentally is my user_id). Any help would be appreciated. Below is the error from my development.log, then the code from my view and controllers. Thanks. development.log Started POST "/line_items?bike_id=86" for 127.0.0.1 at 2011-08-01 18:09:52 -0400 DEPRECATION WARNING: Setting filter_parameter_logging in ActionController is

Multiple <g:select> in one GSP and multiple params in HQL inside controller

放肆的年华 提交于 2019-12-24 04:44:30
问题 GSP <html> <head> <g:javascript src="jquery-1.10.2.min.js"/> <g:javascript src="prototype.js"/> </head> <body> <form> <g:select from="['AFFILIATES', 'SEO', 'SEM','DISPLAYADS']" name="mv" onchange="${remoteFunction( controller:'Pgtyp', action:'ajaxGetMv', params:'\'mv=\' + escape(this.value)', onSuccess: 'printpgtyp(data)')}" ></g:select> </form> <script> function printpgtyp(data) { console.log(data); } </script> </body> </html> CONTROLLER package marchmock2 import grails.converters.* import

Rails checkbox and params

大兔子大兔子 提交于 2019-12-23 11:44:23
问题 I am using many checkboxes in a page as the following: <%= check_box_tag(:one, value = 1) %></p> Imagine that it goes from 1 to 20, all the same with the value changed. How can I get in the controller the params of the ones that were checked? Example: If user checks 3, 5 and 10 how can I get just those params in a single params? 回答1: You'll already get only the ones that were checked; unchecked boxes aren't sent to the server. 来源: https://stackoverflow.com/questions/7870090/rails-checkbox-and

Cost of using params in C#

一个人想着一个人 提交于 2019-12-23 07:19:04
问题 Does anyone have advice for using the params in C# for method argument passing. I'm contemplating making overloads for the first 6 arguments and then a 7th using the params feature. My reasoning is to avoid the extra array allocation the params feature require. This is for some high performant utility methods. Any advice? Is it a waste of code to create all the overloads? 回答1: Honestly, I'm a little bothered by everyone shouting "premature optimization!" Here's why. What you say makes perfect

JSF : I want to send POST request inside action bean

你。 提交于 2019-12-23 05:29:16
问题 I have an action bean method: public void submitForm() { // here bean save some information about input data in local DB saveEnteredData(); // I should redirect to external system page with post params. } So i should save data and make a redirection into page of external system with some params by POST I hope that you'll help me. 回答1: Send a HTTP 307 redirect. Assuming that you're still on JSF 1.x: FacesContext facesContext = FacesContext.getCurrentInstance(); HttpServletResponse response =

Rails: Pass Params Through Ajax

China☆狼群 提交于 2019-12-22 04:26:31
问题 I need to pass params through javascript back to the server. At the moment, I pass them into javascript like so: sendParams("<%= params[:q].to_json %>"); And then send them back like this: function sendParams(q){ $.ajax({ url: '/mymodel/myaction', type: 'post', data: {'q':q}, contentType: 'json' }); } In my controller, I try to use them like I would any other params: MyModel.where(params[:q]) But the params are coming back empty, even though firebug shows this in the POST tab: q=%7B%26quot

Expected ProductField, got array issue

随声附和 提交于 2019-12-22 04:15:10
问题 I have a rails 4 application that has a params block that looks like: def store_params params.require(:store).permit(:name, :description, :user_id, products_attributes: [:id, :type, { productFields: [:type, :content ] } ]) end but I'm getting the error: ActiveRecord::AssociationTypeMismatch in StoresController#create ProductField expected, got Array The parameters I'm trying to insert look like: Parameters: {"utf8"=>"✓", "store"=>{"name"=>"fdsaf", "description"=>"sdfd","products_attributes"=>

Changing the params modifier in a method override

╄→гoц情女王★ 提交于 2019-12-22 03:57:04
问题 I'm aware that a params modifier (which turns in one parameter of array type into a so-called "parameter array") is specifically not a part of the method signature. Now consider this example: class Giraffid { public virtual void Eat(int[] leaves) { Console.WriteLine("G"); } } class Okapi : Giraffid { public override void Eat(params int[] leaves) { Console.WriteLine("O"); } } This compiles with no warnings. Then saying: var okapi = new Okapi(); okapi.Eat(2, 4, 6); // will not compile! gives an

Optional argument followed by Params [duplicate]

被刻印的时光 ゝ 提交于 2019-12-22 03:19:14
问题 This question already has answers here : C# 4.0, optional parameters and params do not work together (3 answers) Closed 6 years ago . So I see that it's possible to have a method signature where the first parameter provides a default value and the second parameter is a params collection. What I can't see is a way to actually use the default value of the first argument. Is it at all possible? Example method: void WaitAllTasks(string message = "Running Task.WaitAll", params Task[] tasks); I