<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Building table based forms in Zend_Form</title>
	<atom:link href="http://davidcaylor.com/2008/03/24/building-table-based-forms-in-zend_form/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidcaylor.com/2008/03/24/building-table-based-forms-in-zend_form/</link>
	<description>linux, web development, and development teams</description>
	<lastBuildDate>Tue, 07 Feb 2012 16:40:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: David</title>
		<link>http://davidcaylor.com/2008/03/24/building-table-based-forms-in-zend_form/#comment-1385</link>
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Wed, 10 Aug 2011 17:06:18 +0000</pubDate>
		<guid isPermaLink="false">http://davidcaylor.com/php/building-table-based-forms-in-zend_form#comment-1385</guid>
		<description><![CDATA[Great!  Thanks for posting that back here.  I&#039;m sure others will be looking for that.]]></description>
		<content:encoded><![CDATA[<p>Great!  Thanks for posting that back here.  I&#8217;m sure others will be looking for that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: niusha</title>
		<link>http://davidcaylor.com/2008/03/24/building-table-based-forms-in-zend_form/#comment-1384</link>
		<dc:creator><![CDATA[niusha]]></dc:creator>
		<pubDate>Wed, 10 Aug 2011 08:18:50 +0000</pubDate>
		<guid isPermaLink="false">http://davidcaylor.com/php/building-table-based-forms-in-zend_form#comment-1384</guid>
		<description><![CDATA[Here is the solution I have found on http://paveldubinin.com/2011/04/real-table-based-form-with-zend-form/ :

- Add a Decorator Class : /library/Form/Decorator/SimpleTable.php

[code][lang=php]
&lt;?php

class Form_Decorator_SimpleTable extends Zend_Form_Decorator_Abstract
{
	public function render ($content)
	{
		$element = $this-&gt;getElement();
		$view	= $element-&gt;getView();
		if (null === $view) {
			return $content;
		}
		
		$columns = $this-&gt;getOption(&#039;columns&#039;);
		$class = $this-&gt;getOption(&#039;class&#039;);
		$id = $this-&gt;getOption(&#039;id&#039;);

		$columns_html = &#039;&#039;;
		foreach ($columns as $current_column_name) {
			$columns_html .= &#039;&lt;th&gt;&#039;.$current_column_name.&#039;&lt;/th&gt;&#039;;
		}

		$result = &#039;
			&lt;table class=&quot;&#039;.$class.&#039;&quot; id=&quot;&#039;.$id.&#039;&quot;&gt;
				&lt;thead&gt;
					&lt;tr&gt;
						&#039;.$columns_html.&#039;
					&lt;/tr&gt;
				&lt;/thead&gt;
				&lt;tbody&gt;
					&#039;.$content.&#039;
				&lt;/tbody&gt;
			&lt;/table&gt;
		&#039;;

		return $result;
	}
}[/code]

Add that line before the line 19 :

$form-&gt;addPrefixPath(&#039;Form_Decorator&#039;, &#039;Form/Decorator/&#039;, &#039;Decorator&#039;);

And replace the line 19 by :

[code]
$form-&gt;setDecorators(array(
				&#039;FormElements&#039;,
				array(	&#039;SimpleTable&#039;,
						array(&#039;columns&#039; =&gt; array(
							&#039;&#039;, &#039;title&#039;, &#039;firstname&#039;, &#039;lastname&#039;))), // &#039;&#039; do not display the id column name
				&#039;Form&#039;));[/code]]]></description>
		<content:encoded><![CDATA[<p>Here is the solution I have found on <a href="http://paveldubinin.com/2011/04/real-table-based-form-with-zend-form/" rel="nofollow">http://paveldubinin.com/2011/04/real-table-based-form-with-zend-form/</a> :</p>
<p>- Add a Decorator Class : /library/Form/Decorator/SimpleTable.php</p>
<pre class="brush: plain;">[lang=php]
&lt;?php

class Form_Decorator_SimpleTable extends Zend_Form_Decorator_Abstract
{
	public function render ($content)
	{
		$element = $this-&gt;getElement();
		$view	= $element-&gt;getView();
		if (null === $view) {
			return $content;
		}

		$columns = $this-&gt;getOption('columns');
		$class = $this-&gt;getOption('class');
		$id = $this-&gt;getOption('id');

		$columns_html = '';
		foreach ($columns as $current_column_name) {
			$columns_html .= '&lt;th&gt;'.$current_column_name.'&lt;/th&gt;';
		}

		$result = '
			&lt;table class=&quot;'.$class.'&quot; id=&quot;'.$id.'&quot;&gt;
				&lt;thead&gt;
					&lt;tr&gt;
						'.$columns_html.'
					&lt;/tr&gt;
				&lt;/thead&gt;
				&lt;tbody&gt;
					'.$content.'
				&lt;/tbody&gt;
			&lt;/table&gt;
		';

		return $result;
	}
}</pre>
<p>Add that line before the line 19 :</p>
<p>$form-&gt;addPrefixPath(&#8216;Form_Decorator&#8217;, &#8216;Form/Decorator/&#8217;, &#8216;Decorator&#8217;);</p>
<p>And replace the line 19 by :</p>
<pre class="brush: plain;">
$form-&gt;setDecorators(array(
				'FormElements',
				array(	'SimpleTable',
						array('columns' =&gt; array(
							'', 'title', 'firstname', 'lastname'))), // '' do not display the id column name
				'Form'));</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://davidcaylor.com/2008/03/24/building-table-based-forms-in-zend_form/#comment-1383</link>
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Tue, 09 Aug 2011 15:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://davidcaylor.com/php/building-table-based-forms-in-zend_form#comment-1383</guid>
		<description><![CDATA[I haven&#039;t actually used the approach outlined in the post in quite a while.  I now generally make very simple forms and then decorate them using more css and javascript rather than trying to accomplish as much in the server&#039;s HTML generation.  However, to answer your question, the way I&#039;d do it if I were using Zend Form decorators is just to fill row 0 of the array with the labels, and start the data on row 1.  Then on line 19 of the larger code example block I&#039;d change it so that where it says 

array(&#039;HtmlTag&#039;, array(&#039;tag&#039; =&gt; &#039;td&#039;)),

it would put a th tag if the row == 0.

I haven&#039;t tested this approach, and there are likely intricacies to implementing it that would need to be be ironed out, but I hope that helps.]]></description>
		<content:encoded><![CDATA[<p>I haven&#8217;t actually used the approach outlined in the post in quite a while.  I now generally make very simple forms and then decorate them using more css and javascript rather than trying to accomplish as much in the server&#8217;s HTML generation.  However, to answer your question, the way I&#8217;d do it if I were using Zend Form decorators is just to fill row 0 of the array with the labels, and start the data on row 1.  Then on line 19 of the larger code example block I&#8217;d change it so that where it says </p>
<p>array(&#8216;HtmlTag&#8217;, array(&#8216;tag&#8217; =&gt; &#8216;td&#8217;)),</p>
<p>it would put a th tag if the row == 0.</p>
<p>I haven&#8217;t tested this approach, and there are likely intricacies to implementing it that would need to be be ironed out, but I hope that helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: niusha</title>
		<link>http://davidcaylor.com/2008/03/24/building-table-based-forms-in-zend_form/#comment-1382</link>
		<dc:creator><![CDATA[niusha]]></dc:creator>
		<pubDate>Tue, 09 Aug 2011 15:29:30 +0000</pubDate>
		<guid isPermaLink="false">http://davidcaylor.com/php/building-table-based-forms-in-zend_form#comment-1382</guid>
		<description><![CDATA[Thanks a lot for your tutorial, it helped me a lot.

I have just one question, already asked by Jeff : 

&lt;blockquote cite=&quot;#commentbody-184&quot;&gt;
&lt;strong&gt;&lt;a href=&quot;#comment-184&quot; rel=&quot;nofollow&quot;&gt;Jeff&lt;/a&gt; :&lt;/strong&gt;
I am trying to setup an entry page for addresses and assets. I would like the labels to be in the tablehead and the entry fields to be rows of the table.
&lt;/blockquote&gt;

Is there a simple way to show the labels on the header of the table ?

Thank you.

Niusha]]></description>
		<content:encoded><![CDATA[<p>Thanks a lot for your tutorial, it helped me a lot.</p>
<p>I have just one question, already asked by Jeff : </p>
<blockquote cite="#commentbody-184"><p>
<strong><a href="#comment-184" rel="nofollow">Jeff</a> :</strong><br />
I am trying to setup an entry page for addresses and assets. I would like the labels to be in the tablehead and the entry fields to be rows of the table.
</p></blockquote>
<p>Is there a simple way to show the labels on the header of the table ?</p>
<p>Thank you.</p>
<p>Niusha</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zeno</title>
		<link>http://davidcaylor.com/2008/03/24/building-table-based-forms-in-zend_form/#comment-187</link>
		<dc:creator><![CDATA[Zeno]]></dc:creator>
		<pubDate>Wed, 07 Jan 2009 00:45:24 +0000</pubDate>
		<guid isPermaLink="false">http://davidcaylor.com/php/building-table-based-forms-in-zend_form#comment-187</guid>
		<description><![CDATA[How about a customisable view phtml for Zend_Form? Without setDecorator()

http://www.yu.id.au/2008/12/customisable-zend-form/]]></description>
		<content:encoded><![CDATA[<p>How about a customisable view phtml for Zend_Form? Without setDecorator()</p>
<p><a href="http://www.yu.id.au/2008/12/customisable-zend-form/" rel="nofollow">http://www.yu.id.au/2008/12/customisable-zend-form/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

