<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ed Spencer &#187; error</title>
	<atom:link href="http://edspencer.net/tag/error/feed" rel="self" type="application/rss+xml" />
	<link>http://edspencer.net</link>
	<description>A Sencha Architect</description>
	<lastBuildDate>Sat, 11 Feb 2012 09:20:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ExtJS Radio Buttons and Square Brackets</title>
		<link>http://edspencer.net/2008/08/extjs-radio-buttons-and-square-brackets.html</link>
		<comments>http://edspencer.net/2008/08/extjs-radio-buttons-and-square-brackets.html#comments</comments>
		<pubDate>Fri, 08 Aug 2008 19:41:00 +0000</pubDate>
		<dc:creator>Ed Spencer</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[ext]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[radio]]></category>

		<guid isPermaLink="false">http://192.168.2.15/Projects/wordpress/?p=9</guid>
		<description><![CDATA[<p>While creating an ExtJS form with several radio buttons today I ran into a bug which caused none of them to work as expected, even though there were no errors/exceptions.  To cut a long story short, it was because I was setting the name to &#8220;schedule[include_type]&#8221; &#8211; like this:</p>
<pre class="brush: jscript;">{
  xtype: 'radio',
  name: 'schedule[include_type]',
  inputValue: 'page',
  boxLabel: 'Show page:'
}
</pre>
<p>This radio button is one of 4, which allows the user which type of file they want to include on a particular model (a Schedule in this case) &#8211; be it Page, Video, Category or one other.  The thing is &#8211; none of them work with the square brackets in the name.  If you remove the brackets, they all work correctly, but the server-side is relying on those brackets to be present to group the data correctly.</p>
<p>In the end I bit the bullet and updated my submit method to add a new parameter directly &#8211; here&#8217;s a full example:</p>
<pre class="brush: jscript;">form = new Ext.form.FormPanel({
  items: [
    {
      xtype: 'radio',
      name: 'include_type',
      inputValue: 'page',
      boxLabel: 'Show page:'
    },
    {
      xtype: 'radio',
      name: 'include_type',
      inputValue: 'category',
      boxLabel: 'Show category:'
    },
    ... plus some extra items
  ],
  buttons: [
    {
      text: 'Save',
      handler: function() {

        //find the currently selected include_type from the form
        var include_type = this.form.getValues()['include_type'];

        //note the params option - this needs to be added manually otherwhise
        //schedule[include_type] won't appear
        form.form.submit({
          waitMsg: 'Saving Data...',
          params: &quot;schedule[include_type]=&quot; + include_type,
          url: some url...
        });
      }
    }
  ]
})
</pre>
<p>Note: I don&#8217;t usually add buttons in the way above so I&#8217;m not sure if the form.form.submit will work correctly here &#8211; see <a href="http://extjs.com/deploy/dev/docs/?class=Ext.form.FormPanel">http://extjs.com/deploy/dev/docs/?class=Ext.form.FormPanel</a> for information about overriding submit.</p>
<p>So what we&#8217;re doing here is finding which radio button is currently checked, and appending this under &#8220;schedule[include_type]&#8221; when POSTing the form variables to the server.  This really isn&#8217;t pleasant but seems to be the best way around this limitation for now.</p>
<p>I regularly use square brackets in other Ext JS Fields &#8211; Radio Buttons seem to be the only ones that have this problem.  <a href="http://extjs.com/forum/showthread.php?p=185296">http://extjs.com/forum/showthread.php?p=185296</a> has a bit of background behind this, but no real solution.</p>
]]></description>
			<content:encoded><![CDATA[<p>While creating an ExtJS form with several radio buttons today I ran into a bug which caused none of them to work as expected, even though there were no errors/exceptions.  To cut a long story short, it was because I was setting the name to &#8220;schedule[include_type]&#8221; &#8211; like this:</p>
<pre class="brush: jscript;">{
  xtype: 'radio',
  name: 'schedule[include_type]',
  inputValue: 'page',
  boxLabel: 'Show page:'
}
</pre>
<p>This radio button is one of 4, which allows the user which type of file they want to include on a particular model (a Schedule in this case) &#8211; be it Page, Video, Category or one other.  The thing is &#8211; none of them work with the square brackets in the name.  If you remove the brackets, they all work correctly, but the server-side is relying on those brackets to be present to group the data correctly.</p>
<p>In the end I bit the bullet and updated my submit method to add a new parameter directly &#8211; here&#8217;s a full example:</p>
<pre class="brush: jscript;">form = new Ext.form.FormPanel({
  items: [
    {
      xtype: 'radio',
      name: 'include_type',
      inputValue: 'page',
      boxLabel: 'Show page:'
    },
    {
      xtype: 'radio',
      name: 'include_type',
      inputValue: 'category',
      boxLabel: 'Show category:'
    },
    ... plus some extra items
  ],
  buttons: [
    {
      text: 'Save',
      handler: function() {

        //find the currently selected include_type from the form
        var include_type = this.form.getValues()['include_type'];

        //note the params option - this needs to be added manually otherwhise
        //schedule[include_type] won't appear
        form.form.submit({
          waitMsg: 'Saving Data...',
          params: &quot;schedule[include_type]=&quot; + include_type,
          url: some url...
        });
      }
    }
  ]
})
</pre>
<p>Note: I don&#8217;t usually add buttons in the way above so I&#8217;m not sure if the form.form.submit will work correctly here &#8211; see <a href="http://extjs.com/deploy/dev/docs/?class=Ext.form.FormPanel">http://extjs.com/deploy/dev/docs/?class=Ext.form.FormPanel</a> for information about overriding submit.</p>
<p>So what we&#8217;re doing here is finding which radio button is currently checked, and appending this under &#8220;schedule[include_type]&#8221; when POSTing the form variables to the server.  This really isn&#8217;t pleasant but seems to be the best way around this limitation for now.</p>
<p>I regularly use square brackets in other Ext JS Fields &#8211; Radio Buttons seem to be the only ones that have this problem.  <a href="http://extjs.com/forum/showthread.php?p=185296">http://extjs.com/forum/showthread.php?p=185296</a> has a bit of background behind this, but no real solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://edspencer.net/2008/08/extjs-radio-buttons-and-square-brackets.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>When Git tells you it failed to push some refs</title>
		<link>http://edspencer.net/2008/04/when-git-tells-you-it-failed-to-push.html</link>
		<comments>http://edspencer.net/2008/04/when-git-tells-you-it-failed-to-push.html#comments</comments>
		<pubDate>Fri, 25 Apr 2008 13:00:00 +0000</pubDate>
		<dc:creator>Ed Spencer</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://192.168.2.15/Projects/wordpress/?p=6</guid>
		<description><![CDATA[<p>I received an unhelpful error while trying to push to a repository on Github today:</p>
<p><span class="code">
<pre>git push<br />
To git@github.com:user/repo.git<br />
! [rejected] branchname -> branchname (non-fast forward)<br />
error: failed to push some refs to 'git@github.com:user/repo.git'[/code]</span><br />
In case you ever have the same problem, all you have to do is a quick git pull first, then you can carry on as normal.  Easy when you know how...</p>
]]></description>
			<content:encoded><![CDATA[<p>I received an unhelpful error while trying to push to a repository on Github today:</p>
<p><span class="code">
<pre>git push<br />
To git@github.com:user/repo.git<br />
! [rejected] branchname -> branchname (non-fast forward)<br />
error: failed to push some refs to 'git@github.com:user/repo.git'[/code]</span><br />
In case you ever have the same problem, all you have to do is a quick git pull first, then you can carry on as normal.  Easy when you know how...</p>
]]></content:encoded>
			<wfw:commentRss>http://edspencer.net/2008/04/when-git-tells-you-it-failed-to-push.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>

