<?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: Need help server validation on dynamic editing</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing</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/need-help-server-validation-on-dynamic-editing/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Candrairawan78 on Need help server validation on dynamic editing</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p19101</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p19101</guid>
        	        	<description><![CDATA[<p>Try this one</p>
<p>$.ajax({&#160; //Make the Ajax Request<br />&#160;&#160; &#160; type: "POST",<br />&#160;&#160; &#160; url: "ajax_check_username.php",&#160; //file name<br />&#160;&#160; &#160; data: "username="+ username,&#160; //data<br />&#160;&#160; &#160; success: function(server_response){<br />&#160;&#160; &#160; <br />&#160;&#160; &#160; $("#availability_status").ajaxComplete(function(event, request){<br />&#160;&#160; &#160; <br />&#160;&#160; &#160; if(server_response == &#39;0&#39;)//if ajax_check_username.php return value "0"<br />&#160;&#160; &#160; {<br />&#160;&#160; &#160; $("#availability_status").html(&#39;&#60;img src="available.png" align="absmiddle"&#62; &#60;font color="Green"&#62; Available &#60;/font&#62;&#160; &#39;);<br />&#160;&#160; &#160; //add this image to the span with id "availability_status"<br />&#160;&#160; &#160; }<br />&#160;&#160; &#160; else&#160; if(server_response == &#39;1&#39;)//if it returns "1"<br />&#160;&#160; &#160; {<br />&#160;&#160; &#160; $("#availability_status").html(&#39;&#60;img src="not_available.png" align="absmiddle"&#62; &#60;font color="red"&#62;Not Available &#60;/font&#62;&#39;);<br />&#160;&#160; &#160; }<br />&#160;&#160; &#160; <br />&#160;&#160; &#160; });<br />&#160;&#160; &#160; }<br />&#160;&#160; &#160; <br />&#160;&#160; &#160; });</p>
</p>
<p>ajax_check_username.php <br />&#160;&#160; &#160; include(&#39;database_connection.php&#39;);<br />&#160;&#160; &#160;//Include The Database Connection File<br />&#160;&#160; &#160; <br />&#160;&#160; &#160;if(isset($_POST[&#39;username&#39;]))//If a username has been submitted<br />&#160;&#160; &#160;{<br />&#160;&#160; &#160;$username = mysql_real_escape_string($_POST[&#39;username&#39;]);//Some clean up 🙂<br />&#160;&#160; &#160; <br />&#160;&#160; &#160;$check_for_username = mysql_query("SELECT userid FROM member WHERE username=&#39;$username&#39;");<br />&#160;&#160; &#160;//Query to check if username is available or not<br />&#160;&#160; &#160; <br />&#160;&#160; &#160;if(mysql_num_rows($check_for_username))<br />&#160;&#160; &#160;{<br />&#160;&#160; &#160;echo &#39;1&#39;;//If there is a&#160; record match in the Database - Not Available<br />&#160;&#160; &#160;}<br />&#160;&#160; &#160;else<br />&#160;&#160; &#160;{<br />&#160;&#160; &#160;echo &#39;0&#39;;//No Record Found - Username is available<br />&#160;&#160; &#160;}<br />&#160;&#160; &#160;}</p>
</p>
<p>hope this will help you</p>
]]></description>
        	        	<pubDate>Thu, 12 Aug 2010 10:56:17 +0300</pubDate>
        </item>
        <item>
        	<title>jboss on Need help server validation on dynamic editing</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p19029</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p19029</guid>
        	        	<description><![CDATA[<p>Can you post the solution so that we can learn?</p>
</p>
<p>thanks</p>
]]></description>
        	        	<pubDate>Mon, 09 Aug 2010 12:51:01 +0300</pubDate>
        </item>
        <item>
        	<title>Candrairawan78 on Need help server validation on dynamic editing</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p19028</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p19028</guid>
        	        	<description><![CDATA[<p>I have found the way.</p>
<p>The problem has solved.</p>
]]></description>
        	        	<pubDate>Mon, 09 Aug 2010 10:24:15 +0300</pubDate>
        </item>
        <item>
        	<title>Candrairawan78 on Need help server validation on dynamic editing</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p19001</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p19001</guid>
        	        	<description><![CDATA[<p>Dear all,</p>
<p>I have changed my validate function to this:</p>
<p>function usercheck(value,ID){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajax({<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type: "POST",</p>
<p>&#160; &#160; &#160; &#160; &#160;&#160; async:false, &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; url: "usercheck.php",<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: {ID:value},<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success: function(msg){<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return [false,msg];<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; });<br />&#160;&#160;&#160; }</p>
<p>//usercheck.php</p>
<p>&#60;?<br />include "config/connections.php";</p>
<p>$id = $_POST[&#39;ID&#39;]; //some variable<br />$return = array();</p>
<p>$SQL = "SELECT * FROM user WHERE ID=&#39;$id&#39;";<br />$result = $db-&#62;query($SQL) or die("Couldn&#39;t execute query.".mysqli_error($db));<br />$numresult=$result-&#62;num_rows;<br />if($numresult==0)<br />&#160;&#160; &#160;$return[&#39;msg&#39;] = &#39;&#39;;<br />else<br />&#160;&#160; $return[&#39;msg&#39;] =&#160; &#39;ID have used, please create another ID..&#39;;<br />&#160;&#160; $a[] = $return;</p>
<p>echo json_encode($a);<br />?&#62;</p>
<p>but I still get error from server:<strong>custom function should return array</strong></p>
<p>Would you please guide me to show correct way to solve this?<strong><img class="spSmiley" style="margin:0" title="Cry" src="/blog/wp-content/forum-smileys/sf-cry.gif" alt="Cry" /></strong></p>
<p>Regards,</p>
<p>Candra<strong><br /></strong></p>
]]></description>
        	        	<pubDate>Fri, 06 Aug 2010 05:18:15 +0300</pubDate>
        </item>
        <item>
        	<title>Candrairawan78 on Need help server validation on dynamic editing</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p18891</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p18891</guid>
        	        	<description><![CDATA[<p>Dear all,</p>
<p>Could anybody assist me how to solve server validation on dynamic editing, please?</p>
<p>I want server to validate user if someone create double ID.</p>
<p>I have been trying for searching this problem from this forum but i did not find the clue.</p>
<p>Please... I really need your help<img class="spSmiley" style="margin:0" title="Cry" src="/blog/wp-content/forum-smileys/sf-cry.gif" alt="Cry" /></p>
<p>Regards,</p>
</p>
<p>Candra</p>
]]></description>
        	        	<pubDate>Sat, 31 Jul 2010 04:49:22 +0300</pubDate>
        </item>
        <item>
        	<title>Candrairawan78 on Need help server validation on dynamic editing</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p18687</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/need-help-server-validation-on-dynamic-editing#p18687</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I found server validation on dynamic editing in this forum.&#160; I have been trying for a while to use this feature .. but I have not been success, i really need the help<img class="spSmiley" style="margin:0" title="Cry" src="/blog/wp-content/forum-smileys/sf-cry.gif" alt="Cry" />.</p>
<p>I want to check if someone add new record, server will check if the ID have been exist, it should show an error alert.</p>
<p>Here is my code</p>
<p>var mygrid =</p>
<p>&#160; jQuery("#list").jqGrid({</p>
<p>&#160;&#160;&#160;&#160;&#160; url:&#39;tabel/tableuserjson.php?q=1&#39;,</p>
<p>&#160;&#160;&#160;&#160;&#160; datatype: &#39;json&#39;, &#60;!--Defines what type of information to expect to represent data in the grid.--&#62;</p>
<p>&#160;&#160;&#160;&#160;&#160; mtype: "POST",</p>
<p>&#160;&#160;&#160;&#160;&#160; colNames:[&#39;ID&#8217;],</p>
<p>&#160;&#160;&#160;&#160;&#160; colModel :[</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;ID&#39;&#160;&#160;&#160;&#160;&#160; , index:&#39;ID&#39;&#160;&#160;&#160;&#160;&#160; , width:10&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , editable:true, editoptions:{size:12, maxlength:&#39;10&#39;}, editrules:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {required:true, custom:true, custom_func:usercheck}, formoptions:{elmprefix:"(*)"}},</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {name:&#39;name&#39;&#160;&#160;&#160; , index:&#39;name&#39;&#160;&#160;&#160; , width:30&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; , editable:true, editoptions:{size:25, maxlength:&#39;20&#39;}, editrules:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {required:true}, formoptions:{elmprefix:"(*)"}},]</p>
<p>&#160;&#160;&#160;&#160; multiselect: true,</p>
<p>&#160;&#160;&#160;&#160; altRows: true,</p>
<p>&#160;&#160;&#160;&#160; pager: &#39;#pager&#39;,</p>
<p>&#160;&#160;&#160;&#160; rowNum:20,</p>
<p>&#160;&#160;&#160;&#160; rownumbers: true,</p>
<p>&#160;&#160;&#160;&#160; gridview: true,</p>
<p>&#160;&#160;&#160;&#160; pginput: false,</p>
<p>&#160;&#160;&#160;&#160; height: 290,</p>
<p>&#160;&#160;&#160;&#160; width: 500,</p>
<p>&#160;&#160;&#160;&#160; sortname: &#39;name&#39;,</p>
<p>&#160;&#160;&#160;&#160; sortorder: &#39;asc&#39;,</p>
<p>&#160;&#160;&#160;&#160; viewrecords: true,</p>
<p>&#160;&#160;&#160;&#160; caption: &#39;USER DATA &#39;,</p>
<p>&#160;&#160;&#160;&#160; editurl:"edituserjson.php",</p>
</p>
<p>jQuery("#list").jqGrid(&#39;navGrid&#39;,&#39;#pager&#39;,{edit:true,add:true,del:true,search:false, refresh:false, view:false},</p>
<p>&#160;&#160;&#160;&#160; {jqModal:true, top: 120, left: 350, drag:false, resize:false, reloadAfterSubmit:true, closeOnEscape:true, checkOnUpdate:true,</p>
<p>&#160;&#160;&#160;&#160; savekey: [false,13], navkeys: [true,38,40], checkOnSubmit : true, bottominfo:"* Required&#8221;, closeAfterEdit:true,</p>
<p>&#160;&#160;&#160;&#160; onInitializeForm : function (formid){&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#ID",formid).change(function() {;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var ret = usercheck(formid)</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } ) ;</p>
<p>&#160;&#160;&#160;&#160; }},// edit options</p>
<p>&#160;&#160;&#160;&#160; );</p>
<p>jQuery("#list").jqGrid(&#39;navButtonAdd&#39;,"#pager",{caption:"Reset",title:"Reset Filter",buttonicon :&#39;ui-icon-refresh&#39;,</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; onClickButton:function(){</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mygrid[0].clearToolbar()</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } });</p>
<p>&#160; function usercheck(value){</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var a = &#39;&#39;;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $.ajax({</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; type: "POST",</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; async: false,</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;url: "usercheck.php",</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; data: {ID:value},</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dataType: "HTML",</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; error: function(){</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; a = [false,"Could not contact the server!",""];</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; },</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; success: function(msg){</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(msg == 1){</p>
<p>&#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;&#160;&#160; a = [false,"You must set an ID!",""];&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }else if(msg == 2){</p>
<p>&#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;&#160;&#160; a = [false,"Your ID is not correct",""];&#160;&#160;&#160;&#160;&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }else if(msg == 3){</p>
<p>&#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;&#160;&#160; a = [false,"Your ID is allredy in the system",""];&#160;&#160;&#160;&#160;&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }else if(msg == 4){</p>
<p>&#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;&#160;&#160; a = [true,""];&#160;&#160;&#160;&#160;&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160; });</p>
<p>&#160; return a;</p>
<p>&#160;&#160;}</p>
<p>});</p>
</p>
<p>Usercheck.php</p>
<p>&#60;?//i am not sure how to handle from server side, please help me</p>
<p>include "config/connections.php";</p>
<p>$id = $_POST[&#39;ID&#39;]; //some variable</p>
<p>&#160; $SQL = "SELECT * FROM user WHERE ID=$id";</p>
<p>&#160; $result = $db-&#62;query($SQL) or die("Couldn&#39;t execute query.".mysqli_error($db));</p>
<p>&#160; $numresult=$result-&#62;num_rows;</p>
<p>if($numresult=0){</p>
<p>&#160;&#160;&#160; echo &#39;&#160; ""&#160; &#39;</p>
<p>}else{</p>
<p>&#160;&#160; echo &#39;&#160; "ID have been exist, please create another ID.."&#160; &#39;</p>
<p>}</p>
<p>?&#62;</p>
<p>Can you help me or at least point me from where I can start up? Assistance, as always, greatly appreciated. Thanks</p>
</p>
<p>Greetings.</p>
</p>
<p>Candra</p>
]]></description>
        	        	<pubDate>Tue, 20 Jul 2010 08:13:43 +0300</pubDate>
        </item>
</channel>
</rss>