<?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: beforeSubmit problem</title>
	<link>http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem</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/discussion/beforesubmit-problem/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>jquerz on beforeSubmit problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p24507</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p24507</guid>
        	        	<description><![CDATA[<p>hi handelcamilo,</p>
<p>To solve the problem&#160;I did this.</p>
<p>1) use the&#160;formatter&#160;module&#160;to create&#160;a button&#160;that allows me to&#160;upload the file.</p>
<blockquote>
<p>function uploadButton(cellvalue, opts, rowObject) {</p>
<p>/*</p>
<p>opts - a set of options containing</p>
<p>rowId - the id of the row</p>
<p>colModel - the colModel for this column</p>
<p>rowData - the data for this row</p>
<p>//*/</p>
</p>
<p>rowId=opts.rowId;</p>
<p>input="&#60;input style=&#39;height:22px;width:20px;&#39; type=&#39;button&#39; value=&#39;...&#39; onclick=uploadfile("+rowId+"); /&#62;";</p>
<p>return cellvalue+input;</p>
</p>
<p>}</p>
</blockquote>
<p>2) in the colmodel&#160;describe&#160;the uploadButton function.&#160;</p>
<blockquote>
<p>{name:&#39;fileToUpload&#39;, index:&#39;fileToUpload&#39;, width:300, editable:false,edittype:&#39;file&#39;,editoptions:{size:40},editrules:{required:true}, <strong>formatter:uploadButton</strong>}</p>
</blockquote>
<p>3) uploadfile function</p>
</p>
<blockquote>
<p>$( "#formupload" ).hide();</p>
<p>uploadfile=function(rowId){</p>
</p>
<p>$("#fileToUpload").val("");</p>
<p>$( "#formupload" ).dialog({</p>
<p>autoOpen: false,</p>
<p>height: 110,</p>
<p>width: 280,</p>
<p>modal: true,</p>
<p>buttons: {</p>
<p>"Subir": function() {</p>
<p>value=$("#fileToUpload").val();</p>
<p>//SI DA CLICK EN SUBIR PROCEDO A SUBIR EL ARCHIVO MEDIANTE EL PLUGIN</p>
<p>$.ajaxFileUpload({</p>
<p>url:&#39;../ajaxfileupload1.0/doajaxfileupload.php&#39;,</p>
<p>secureuri:false,</p>
<p>fileElementId:&#39;fileToUpload&#39;,</p>
<p>dataType: &#39;json&#39;,</p>
<p>path:&#39;../../images/originales/&#39;,</p>
<p>success: function (data, status) {&#160;</p>
<p>if(typeof(data.error) != &#39;undefined&#39;)</p>
<p>{</p>
<p>if(data.error != &#39;&#39;)</p>
<p>{</p>
</p>
<p>message=data.error;</p>
<p>alert(message);</p>
</p>
<p>}else{</p>
</p>
<p>message=data.msg;</p>
<p>namefile=message;</p>
<p>$("#formupload").dialog( "close" );</p>
<p><strong>//ACTUALIZO LA CELL, 1 ES EL NUMERO DE LA COLUMNA, SI LA COLUMNA PARA SUBIR ARCHIVOS ES OTRA DEBES CAMBIAR</strong></p>
<p>$(&#39;#list&#39;).setCell(rowId,<strong>1</strong>,"images/thumbnails/enlacesweb/"+namefile); <strong>//READ READ</strong></p>
<p>}&#160;</p>
</p>
<p>}</p>
</p>
<p>},</p>
<p>error: function (data, status, e)</p>
<p>{</p>
<p>complete=false;</p>
<p>message=e;</p>
<p>alert(e);</p>
<p>}</p>
<p>});//TERMINA AJAX FILE UPLOAD</p>
</p>
<p>},</p>
<p>Cancel: function() {</p>
<p>$( this ).dialog( "close" );</p>
<p>}</p>
<p>}</p>
<p>});</p>
<p>$("#formupload").dialog( "open" );//ABRO LA VENTANA</p>
<p>}</p>
</blockquote>
<p>5) HTML</p>
<blockquote>
<p>&#60;form id="formupload" enctype="multipart/form-data" name="formupload" method="post" action="" title="Subir Imagen para Enlace Web"&#62;</p>
<p>&#60;input id="fileToUpload" name="fileToUpload" type="file" size="40" value="" /&#62;&#160;</p>
<p>&#60;/form&#62;</p>
</p>
</blockquote>
<p>6) SCRIPTS</p>
<blockquote>
<p>&#60;script src="../js/jquery-1.5.1.min.js" type="text/javascript"&#62;&#60;/script&#62;</p>
<p>&#60;script src="../js/jquery-ui-1.8.11.custom.min.js" type="text/javascript"&#62;&#60;/script&#62;</p>
<p>&#60;script src="../js/i18n/grid.locale-es.js" type="text/javascript"&#62;&#60;/script&#62;</p>
<p>&#60;script src="../js/jquery.jqGrid.min.js" type="text/javascript"&#62;&#60;/script&#62;</p>
<p>&#60;script src="../ajaxfileupload1.0/ajaxfileupload.js" type="text/javascript"&#62;&#60;/script&#62;</p>
</blockquote>
<p>That is the&#160;code,&#160;what&#160;to do.&#160;If for&#160;some reason&#160;you could not&#160;do it, then&#160;send me&#160;an email.</p>
<blockquote>
</blockquote>
<p>The other option is&#160;to&#160;contact me&#160;by&#160;email&#160;and I&#160;of&#160;the plugin that&#160;I&#160;modified to&#160;be more optimistic&#160;and&#160;to work with&#160;this code.</p>
<p>The ajaxfileupload download link: <a href="http://www.phpletter.com/Our-Projects/" rel="nofollow" target="_blank">http://www.phpletter.com/Our-Projects/</a><strong>AjaxFileUpload</strong>/</p>
<p><span style="font-family: monospace;">&#160;</span></p>
]]></description>
        	        	<pubDate>Fri, 02 Sep 2011 15:59:54 +0300</pubDate>
        </item>
        <item>
        	<title>handelcamilo on beforeSubmit problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p24503</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p24503</guid>
        	        	<description><![CDATA[<p>Hi jquerz,</p>
<p>I&#39;m having the same issue. How did you resolved it?!</p>
<p>Thank you!!</p>
]]></description>
        	        	<pubDate>Fri, 02 Sep 2011 03:31:34 +0300</pubDate>
        </item>
        <item>
        	<title>jquerz on beforeSubmit problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20968</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20968</guid>
        	        	<description><![CDATA[<p>Thanks oleg, I&#39;ve resolved.</p>
<p>thank you very much for the help.</p>
</p>
<p>Regards</p>
<p>Sergio&#160;<img class="spSmiley" style="margin:0" title="Smile" src="/blog/wp-content/forum-smileys/sf-smile.gif" alt="Smile" /></p>
]]></description>
        	        	<pubDate>Wed, 24 Nov 2010 03:12:51 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on beforeSubmit problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20949</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20949</guid>
        	        	<description><![CDATA[<p>Hi Sergio,</p>
<p>You JavaScript code has many syntax errors. For example</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4035' value='Select Code' data-codeid='sfcode4035' /></p>
<div class='sfcode' id='sfcode4035'>&#8230;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; editrules:{required:true /*,url:true*/}},<br />&#160;&#160;&#160; ],<br />&#8230;<br />&#160;&#160;&#160; editurl:&#34;server.php&#34;,<br />);</p>
<p>$(&#34;#list&#34;).navGrid(&#39;#pager&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {view:true,del:true,add:true,edit:true,refresh:true,},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; prmEdit = {width:400,height:&#39;100%&#39;,},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; prmAdd = {width:400,height:&#39;100%&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; beforeSubmit:function(postdata, formid) {<br />&#8230;</p>
</div>
<p>should be rewritten as</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3895' value='Select Code' data-codeid='sfcode3895' /></p>
<div class='sfcode' id='sfcode3895'>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; editrules:{required:true /*,url:true*/}}<br />&#160;&#160;&#160; ],<br />&#8230;<br />&#160;&#160;&#160; editurl:&#34;server.php&#34;<br />);</p>
<p> $(&#34;#list&#34;).navGrid(&#39;#pager&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {view:true,del:true,add:true,edit:true,refresh:true},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {width:400,height:&#39;100%&#39;},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {width:400,height:&#39;100%&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; beforeSubmit:function(postdata, formid) {<br />&#8230;</p>
</div>
<p>It must be NO commas befor close paranceses (&#39;,}&#39; and &#39;,]&#39; must de &#39;}&#39; and &#39;]&#39;). NO "prmEdit =" , "prmAdd =", "prmDel =", "prmSearch =" and "prmView =" should be used. The last parameters with default {} can be emitted.</p>
<p>Try with the following code:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6634' value='Select Code' data-codeid='sfcode6634' /></p>
<div class='sfcode' id='sfcode6634'>$(&#34;#list&#34;).jqGrid({<br />&#160;&#160;&#160; url:&#39;queryEnlacesW.php&#39;,<br />&#160;&#160;&#160; datatype: &#39;xml&#39;,<br />&#160;&#160;&#160; mtype: &#39;POST&#39;,<br />&#160;&#160;&#160; colNames:[&#39;ID&#39;,&#39;URL Imagen&#39;,&#39;URL&#39;],<br />&#160;&#160;&#160; colModel :[<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;idEnlaceweb&#39;, index:&#39;idEnlaceweb&#39;, width:80,editable:false},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;fileToUpload&#39;, index:&#39;fileToUpload&#39;, width:300, editable:true,edittype:&#39;file&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; editoptions:{size:40},editrules:{required:true}},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;url&#39;, index:&#39;url&#39;, width:250, editable:true,editoptions:{size:40},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; editrules:{required:true /*,url:true*/}}<br />&#160;&#160;&#160; ],<br />&#160;&#160;&#160; pager: &#39;#pager&#39;,<br />&#160;&#160;&#160; rowNum:10,<br />&#160;&#160;&#160; rowList:[10,20,30],<br />&#160;&#160;&#160; sortname: &#39;idEnlaceweb&#39;,<br />&#160;&#160;&#160; sortorder: &#39;desc&#39;,<br />&#160;&#160;&#160; viewrecords: true,<br />&#160;&#160;&#160; caption: &#39;M&#243;dulo de Enlaces Web&#39;,<br />&#160;&#160;&#160; width:700,<br />&#160;&#160;&#160; height:300,<br />&#160;&#160;&#160; editurl:&#34;server.php&#34;<br />});</p>
<p>$(&#34;#list&#34;).navGrid(<br />&#160;&#160;&#160; &#39;#pager&#39;,<br />&#160;&#160;&#160; {view:true,del:true,add:true,edit:true,refresh:true},<br />&#160;&#160;&#160; {width:400,height:&#39;100%&#39;},<br />&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; width:400,height:&#39;100%&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; beforeSubmit:function(postdata, formid) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(formid).attr(&#34;method&#34;,&#34;POST&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(formid).attr(&#34;action&#34;,&#34;&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(formid).attr(&#34;enctype&#34;,&#34;multipart/form-data&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var complete=false;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var message=&#34;&#34;;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var namefile=&#34;&#34;;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajaxFileUpload({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url:&#39;../ajaxfileupload1.0/doajaxfileupload.php&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; secureuri:false,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; fileElementId:&#39;fileToUpload&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dataType: &#39;json&#39;,<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success: function (data, status) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (typeof(data.error) != &#39;undefined&#39;) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (data.error !== &#39;&#39;) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //alert(data.error);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; message=data.error;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#fileToUpload&#34;).val(&#34;&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; complete=true;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; message=data.msg;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; namefile=message;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var newurl=&#39;server.php?nameFile=&#39;+namefile;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#34;#list&#34;).setGridParam({editurl:newurl});<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; error: function (data, status, e) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; complete=false;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; message=e;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });//PROBLEM ;(<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return [complete,message];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; },<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; afterSubmit: function (response, postdata) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //alert(postdata.url);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var success=true;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var message=&#34;&#34;;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var json=response.responseText; //obtengo el json ;D<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var result=$.parseJSON(json);//vuelvo el json en otro json valido<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (result.query===true) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; alert(&#34;Se ejecuto todo correctamente&#34;);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; message=&#34;Hubo un error en el servidor:&#34;+result.query;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success=false;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return [success,message];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160; },<br />&#160;&#160;&#160; {},<br />&#160;&#160;&#160; {multipleSearch:false}<br />);</p>
</div>
<p>I would recommend you to use <a href="http://www.jslint.com/" target="_blank">JSLint</a> to verify your JavaScript code.</p>
<p>Regards<br />Oleg</p></p>
]]></description>
        	        	<pubDate>Tue, 23 Nov 2010 11:43:17 +0200</pubDate>
        </item>
        <item>
        	<title>jquerz on beforeSubmit problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20943</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20943</guid>
        	        	<description><![CDATA[<p>hi my friend,</p>
<p>A little more information about my code.</p>
<p>Full code <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" /></p>
</p>
<p>$("#list").jqGrid({</p>
<p>url:&#39;queryEnlacesW.php&#39;,</p>
<p>datatype: &#39;xml&#39;,</p>
<p>mtype: &#39;POST&#39;,</p>
<p>colNames:[&#39;ID&#39;,&#39;URL Imagen&#39;,&#39;URL&#39;],</p>
<p>colModel :[</p>
<p>{name:&#39;idEnlaceweb&#39;, index:&#39;idEnlaceweb&#39;, width:80,editable:false},</p>
<p>{name:&#39;fileToUpload&#39;, index:&#39;fileToUpload&#39;, width:300, editable:true,edittype:&#39;file&#39;,editoptions:{size:40},editrules:{required:true}},</p>
<p>{name:&#39;url&#39;, index:&#39;url&#39;, width:250, editable:true,editoptions:{size:40},editrules:{required:true /*,url:true*/}},</p>
<p>],</p>
<p>pager: &#39;#pager&#39;,</p>
<p>rowNum:10,</p>
<p>rowList:[10,20,30],</p>
<p>sortname: &#39;idEnlaceweb&#39;,</p>
<p>sortorder: &#39;desc&#39;,</p>
<p>viewrecords: true,</p>
<p>caption: &#39;M&#243;dulo de Enlaces Web&#39;,</p>
<p>width:700,</p>
<p>height:300,</p>
<p>editurl:"server.php",</p>
</p>
<p>});</p>
<p>$("#list").navGrid(&#39;#pager&#39;,{</p>
<p>view:true,</p>
<p>del:true,</p>
<p>add:true,</p>
<p>edit:true,</p>
<p>refresh:true,</p>
</p>
<p>},</p>
<p>prmEdit = {</p>
</p>
<p>width:400,</p>
<p>height:&#39;100%&#39;,</p>
<p>},</p>
<p>prmAdd = {</p>
<p>width:400,</p>
<p>height:&#39;100%&#39;,</p>
<p>beforeSubmit:function(postdata, formid)</p>
<p>{</p>
<p>$(formid).attr("method","POST");</p>
<p>$(formid).attr("action","");</p>
<p>$(formid).attr("enctype","multipart/form-data");</p>
<p>var complete=false;</p>
<p>var message="";</p>
<p>var namefile="";</p>
<p>$.ajaxFileUpload({</p>
<p>url:&#39;../ajaxfileupload1.0/doajaxfileupload.php&#39;,</p>
<p>secureuri:false,</p>
<p>fileElementId:&#39;fileToUpload&#39;,</p>
<p>dataType: &#39;json&#39;,</p>
<p>success: function (data, status) {</p>
</p>
<p>if(typeof(data.error) != &#39;undefined&#39;)</p>
<p>{</p>
<p>if(data.error != &#39;&#39;)</p>
<p>{</p>
<p>//alert(data.error);</p>
<p>message=data.error;</p>
</p>
<p>}else{</p>
<p>$("#fileToUpload").val("");</p>
<p>complete=true;</p>
<p>message=data.msg;</p>
<p>namefile=message;</p>
<p>newurl=&#39;server.php?nameFile=&#39;+namefile;</p>
<p>$("#list").setGridParam({editurl:newurl});</p>
</p>
<p>}</p>
<p>}</p>
<p>},</p>
<p>error: function (data, status, e)</p>
<p>{</p>
<p>complete=false;</p>
<p>message=e;</p>
<p>}</p>
</p>
<p>});//PROBLEM ;(</p>
<p>return [complete,message];</p>
</p>
<p>},</p>
<p>afterSubmit: function (response, postdata)</p>
<p>{</p>
<p>//alert(postdata.url);</p>
<p>var success=true;</p>
<p>var message="";</p>
<p>var json=response.responseText; //obtengo el json ;D</p>
<p>var result=$.parseJSON(json);//vuelvo el json en otro json valido</p>
<p>if(result.query==true){</p>
<p>alert("Se ejecuto todo correctamente");</p>
<p>}</p>
<p>else{</p>
<p>message="Hubo un error en el servidor:"+result.query;</p>
<p>success=false;</p>
<p>}</p>
</p>
<p>return [success,message];</p>
<p>}</p>
<p>},</p>
<p>prmDel = {},</p>
<p>prmSearch = {multipleSearch:false},</p>
<p>prmView = {}</p>
<p>);</p>
</p>
<p>This code works perfect, but if the plugin is first run ajaxfileupload. The problem I have in the beforeSubmit is that this does not expect to finish the ajaxfileupload. Then the function returns the result first, before running the ajaxfileupload.</p>
</p>
<p>One solution is that the ajax call should be synchronous, but this plugin does not.</p>
<p>Another possible solution is that there is another way to return. (?) :DDD</p>
</p>
<p>Thank you,<img class="spSmiley" style="margin:0" title="Cool" src="/blog/wp-content/forum-smileys/sf-cool.gif" alt="Cool" /></p>
</p>
<p>Regards</p>
<p>Sergio</p></p>
]]></description>
        	        	<pubDate>Mon, 22 Nov 2010 16:38:34 +0200</pubDate>
        </item>
        <item>
        	<title>OlegK on beforeSubmit problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20939</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20939</guid>
        	        	<description><![CDATA[<p>Could you post more full definition of the jqGrid which you use? Do use use <strong>edittype:&#39;file&#39;</strong> (see <a href="/jqgridwiki/doku.php?id=wiki:common_rules#file" target="_blank">documentation</a>) in the corresponding <strong>colModel</strong>?</p>
<p>Regards<br />Oleg&#160;</p>
]]></description>
        	        	<pubDate>Mon, 22 Nov 2010 12:44:47 +0200</pubDate>
        </item>
        <item>
        	<title>jquerz on beforeSubmit problem</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20934</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/beforesubmit-problem#p20934</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>The problem I have is to run an ajax call.&#160;I&#39;m using the plugin ajaxfileupload.&#160;The return of the function is executed before the ajax, then this will always return false.</p>
<p>Interestingly, if I put an alert before the return everything works great.</p>
<p>Any advice?&#160;: D</p>
<p>CODE:</p>
</p>
<p>beforeSubmit:function(postdata, formid)		{</p>
<p>$(formid).attr("method","POST");</p>
<p>$(formid).attr("action","");			$(formid).attr("enctype","multipart/form-data");</p>
<p>var complete=false;</p>
<p>var message="";</p>
<p>var namefile="";</p>
<p>$.ajaxFileUpload({</p>
<p>url:&#39;../ajaxfileupload1.0/doajaxfileupload.php&#39;,</p>
<p>secureuri:false,</p>
<p>fileElementId:&#39;fileToUpload&#39;,</p>
<p>dataType: &#39;json&#39;,</p>
<p>success: function (data, status) {</p>
<p>if(typeof(data.error) != &#39;undefined&#39;)							{</p>
<p>if(data.error != &#39;&#39;)								{</p>
<p>message=data.error;																	}else{</p>
<p>$("#fileToUpload").val("");</p>
<p>complete=true;</p>
<p>message=data.msg;</p>
<p>namefile=message;</p>
<p>newurl=&#39;server.php?nameFile=&#39;+namefile;</p>
<p>$("#list").setGridParam({editurl:newurl});</p>
<p>&#160;									alert(namefile);									alert(complete);</p>
<p>}							}																				},</p>
<p>error: function (data, status, e)						{								 &#160;</p>
<p>&#160;complete=false;												message=e;</p>
<p>} });</p>
<p>//FIRST RUN</p>
<p>//THE RETURN SHOULD EXPECT TO RUN AJAX 🙁</p>
<p>&#160; return [complete,message];</p>
<p>}</p>
<p>I have tried everything ;(</p>
<p>Any advice?&#160;: D</p>
<p>Thank you very much and please excuse my English.</p>
</p>
<p>Sergio</p>
<p>Good luck&#160;</p></p>
]]></description>
        	        	<pubDate>Mon, 22 Nov 2010 04:31:58 +0200</pubDate>
        </item>
</channel>
</rss>