<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: formedit select multiple submit as POST or GET array</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-select-multiple-submit-as-post-or-get-array</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/formedit-select-multiple-submit-as-post-or-get-array/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>akremedy on formedit select multiple submit as POST or GET array</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-select-multiple-submit-as-post-or-get-array#p6225</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-select-multiple-submit-as-post-or-get-array#p6225</guid>
        	        	<description><![CDATA[<p>Thanks Tony, that helps explain the reference I saw in the docs to the comma separated string...it just wasn&#39;t looking like that was how the data was posting.&#160; I think I was dancing all around the simple solution here but didn&#39;t quite see it.</p>
<p>Thanks again!</p>
]]></description>
        	        	<pubDate>Wed, 22 Apr 2009 12:10:57 +0300</pubDate>
        </item>
        <item>
        	<title>tony on formedit select multiple submit as POST or GET array</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-select-multiple-submit-as-post-or-get-array#p6204</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-select-multiple-submit-as-post-or-get-array#p6204</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>When we have a multiple select the data from select is posted separated with comma -&#160; i.e. key1,key2...</p>
<p>Here is what I do in PHP suppose this is a filed myname then</p>
<p>$lid = $_GET[&#39;myname&#39;];</p>
<p>$selects = explode(",",$lid);</p>
<p>This will return&#160; array of type array(&#39;key1&#39;,key2,...);</p>
<p>Hope this helps</p>
<p>Regards</p>
<p>Tony</p></p>
]]></description>
        	        	<pubDate>Wed, 22 Apr 2009 06:44:28 +0300</pubDate>
        </item>
        <item>
        	<title>akremedy on formedit select multiple submit as POST or GET array</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/formedit-select-multiple-submit-as-post-or-get-array#p6181</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/formedit-select-multiple-submit-as-post-or-get-array#p6181</guid>
        	        	<description><![CDATA[</p>
<p>I&#39;m looking for some advice on how to handle &#60;select multiple&#62; submits from jqGrid.&#160; I&#39;m using formedit, version 3.5A2.</p>
<p>Again, this is a &#60;select&#62; field with multiple selections possible.&#160; I&#39;m using GET now for easier troubleshooting...if it matters.&#160; Note that everything works fine when only one option is selected.&#160; When multiple options are selected, only the last one is actually recognized on the backend (insert into db via php).&#160; I see multiple selections get sent in the GET, but not as an array.</p>
<p>I have fixed this in two ways, but one breaks something else, and the other one requires a hack to grid.common.js.</p>
<p>Fix #1: in colModel, simply define the name of the &#60;select&#62; field as "name[]" - giving the square brackets makes it recognizable as an array.&#160; The problem is that I dynamically set &#60;options&#62; into this field, and the function doesn&#39;t like field names with "[" or "]".</p>
<p>Fix #2: in grid.common.js, in the createEl function, append the square brackets to the field name:&#160; options.name = options.name+"[]"; .&#160;&#160; This actually works just fine in all of the testing that I&#39;ve done, but wondering if there is a better way.</p>
<p>For reference:</p>
<p>colModel:</p>
<p><span class="sfcode">{name:"username",index:"username",width:500,align:&#39;left&#39;,editable:true,edittype:&#39;select&#39;,editoptions:{title:&#39;Use &#60;ctrl&#62; left-click to select multiple people.&#39;,fixedsize:5,multiple:true,value:":"}}</span></p>
<p>the function that sets "username":</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9821' value='Select Code' data-codeid='sfcode9821' /></p>
<div class='sfcode' id='sfcode9821'>beforeShowForm:function(formid){<br />&#160;&#160;&#160; $.ajax({<br />&#160;&#160;&#160; &#160;&#160;&#160; url:".assets/admin_funcs.php?oper=selpplsel&#38;fid="+fid+"&#38;lid="+row_id,<br />&#160;&#160;&#160; &#160;&#160;&#160; datatype:"script",<br />&#160;&#160;&#160; &#160;&#160;&#160; mtype:"GET",<br />&#160;&#160;&#160; &#160;&#160;&#160; success:function(response) {<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;#username&#39;,formid).children().remove().end().html(response);<br />&#160;&#160;&#160; &#160;&#160;&#160; }<br />&#160;&#160;&#160; })<br />},</div>
<p>the php insert:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7161' value='Select Code' data-codeid='sfcode7161' /></p>
<div class='sfcode' id='sfcode7161'>$pid = $_GET[&#39;username&#39;];<br />$lid = $_GET[&#39;lid&#39;];<br />foreach ($pid as $p) {<br />&#160;&#160; &#160;$ins = "INSERT INTO people2links (pid,lid) VALUES(&#39;$p&#39;,&#39;$lid&#39;)";<br />&#160;&#160; &#160;@mysql_query($ins) or die("error".mysql_error());<br />}</div>
<p>Thanks in advance,</p>
<p>Adam</p>
]]></description>
        	        	<pubDate>Mon, 20 Apr 2009 11:50:48 +0300</pubDate>
        </item>
</channel>
</rss>