<?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: editrules to validate url</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/editrules-to-validate-url</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/feature-request/editrules-to-validate-url/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on editrules to validate url</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/editrules-to-validate-url#p6590</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/editrules-to-validate-url#p6590</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thanks. Added. You can see the change in GitHub.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 09 May 2009 10:15:35 +0300</pubDate>
        </item>
        <item>
        	<title>akremedy on editrules to validate url</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/editrules-to-validate-url#p6563</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/editrules-to-validate-url#p6563</guid>
        	        	<description><![CDATA[<p>Hi Tony, I add an editrules option to validate URLs that I thought was worth suggesting.&#160; I think someone who is a lot better at REGEX than I am could take this much further, but I&#39;ll post the basic expression that I&#39;ve settled on for now.</p>
<p>I did this for 3.5A3 - in grid.common.js, add the following in function checkValues</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7885' value='Select Code' data-codeid='sfcode7885' /></p>
<div class='sfcode' id='sfcode7885'>// begin: url validation<br />&#160;&#160; &#160;&#160;&#160; &#160;if(edtrul.url === true) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if( !(rqfield === false &#38;&#38; isEmpty(val)) ) {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;var filter = /^(((https?)&#124;(ftp)):\\/\\/([\\-\\w]+\\.)+\\w{2,3}(\\/[%\\-\\w]+(\\.\\w{2,})?)*(([\\w\\-\\.\\?\\\\/+@&#38;#;`~=%!]*)(\\.\\w{2,})?)*\\/?)/i;<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;if(!filter.test(val)) {return [false,g.p.colNames[valref]+": "+jQuery.jgrid.edit.msg.url,""];}<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;}<br />&#160;&#160; &#160;&#160;&#160; &#160;}<br />// end: url validation</div>
</p>
<p>and in grid.locale-en.js, in the "edit" block, I added</p>
<p><span class="sfcode">url: "is not a valid URL...prefix required (&#39;<a href="http://&#038;#39" rel="nofollow" target="_blank">http://&#038;#39</a>; or &#39;<a href="https://&#038;#39" rel="nofollow" target="_blank">https://&#038;#39</a>;)",</span></p>
<p>and of course, in the colModel,</p>
<p><span class="sfcode">editrules:{url:true}</span></p>
<p>If shear length is any indication of a REGEX&#39;s effectiveness, the one at the end of this page looks pretty good (also posted below):&#160; <a href="http://geekswithblogs.net/casualjim/archive/2005/12/01/61722.aspx" rel="nofollow" target="_blank">http://geekswithblogs.net/casualjim/archive/2005/12/01/61722.aspx</a></p>
<p><span class="sfcode">^(?#Protocol)(?:(?:ht&#124;f)tp(?:s?)\\:\\/\\/&#124;~/&#124;/)?(?#Username:Password)(?:\\w+:\\w+@)?(?#Subdomains)(?:(?:[-\\w]+\\.)+(?#TopLevel Domains)(?:com&#124;org&#124;net&#124;gov&#124;mil&#124;biz&#124;info&#124;mobi&#124;name&#124;aero&#124;jobs&#124;museum&#124;travel&#124;[a-z]{2}))(?#Port)(?::[\\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\\w~!$+&#124;.,=]&#124;%[a-f\\d]{2})+)+&#124;/)+&#124;\\?&#124;#)?(?#Query)(?:(?:\\?(?:[-\\w~!$+&#124;.,*:]&#124;%[a-f\\d{2}])+=(?:[-\\w~!$+&#124;.,*:=]&#124;%[a-f\\d]{2})*)(?:&#38;(?:[-\\w~!$+&#124;.,*:]&#124;%[a-f\\d{2}])+=(?:[-\\w~!$+&#124;.,*:=]&#124;%[a-f\\d]{2})*)*)*(?#Anchor)(?:#(?:[-\\w~!$+&#124;.,*:=]&#124;%[a-f\\d]{2})*)?$ </span></p>
<p>but it threw an error and I couldn&#39;t even begin to debug it, so went with the simple example above.</p>
<p>Thanks!</p>
<p>Adam</p></p>
]]></description>
        	        	<pubDate>Fri, 08 May 2009 18:41:24 +0300</pubDate>
        </item>
</channel>
</rss>