<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Zendcasts Forum / ZC47 – Zend_Form Decorators Explained]]></title>
		<link>http://www.zendcasts.com/forum/viewtopic.php?id=144</link>
		<description><![CDATA[The most recent posts in ZC47 – Zend_Form Decorators Explained.]]></description>
		<lastBuildDate>Thu, 24 Mar 2011 00:58:25 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=1338#p1338</link>
			<description><![CDATA[<p>Hello,</p><p>I am trying to create a printable representations of a completed form.<br />So, instead of a input field, I have added a form element called Note</p><p>class SF_Form_Element_Note extends Zend_Form_Element_Xhtml<br />{</p><p>public $helper = ‘formNote’;<br />}</p><p>My problem is that I am trying to place a span tag around the data text</p><p>my decorator for this field is as follows:</p><p>public function printDecorators ($id)<br />{</p><p>return array(<br />array(‘ViewHelper’, array(array(‘data’ =&gt; ‘HtmlTag’), array(‘tag’ =&gt;’span’)),<br />array(array(‘data2′ =&gt; ‘HtmlTag’), array(‘tag’ =&gt;’span’, ‘id’ =&gt; $id))),<br />array(‘Label’, array(‘tag’ =&gt;’span’)),<br />array(‘Errors’),<br />array(‘HtmlTag’)<br />);</p><p>I get</p><p>&lt;div&gt;<br />&lt;/div&gt;&lt;span id=&quot;printtab-first_name-label&quot;&gt;&lt;label for=&quot;printtab-first_name&quot; class=&quot;optional&quot;&gt;First Name&lt;/label&gt;&lt;/span&gt;<br />Jeffery&lt;/div&gt;<br />&lt;div&gt;&lt;span id=&quot;printtab-last_name-label&quot;&gt;&lt;label for=&quot;printtab-last_name&quot; class=&quot;optional&quot;&gt;Last Name&lt;/label&gt;&lt;/span&gt;<br />Shipman&lt;/div&gt;<br />&lt;/div&gt;</p><p>what I would like is</p><p>&lt;div&gt;<br />&lt;/div&gt;&lt;span id=&quot;printtab-first_name-label&quot;&gt;&lt;label for=&quot;printtab-first_name&quot; class=&quot;optional&quot;&gt;First Name&lt;/label&gt;&lt;/span&gt;<br />&lt;span id=&quot;first&quot;&gt;Jeffery&lt;/span&gt;&lt;/div&gt;<br />&lt;div&gt;&lt;span id=&quot;printtab-last_name-label&quot;&gt;&lt;label for=&quot;printtab-last_name&quot; class=&quot;optional&quot;&gt;Last Name&lt;/label&gt;&lt;/span&gt;<br />&lt;span id=&quot;last&quot;&gt;Shipman&lt;/span&gt;&lt;/div&gt;<br />&lt;/div&gt;</p>]]></description>
			<author><![CDATA[dummy@example.com (jeff shipman)]]></author>
			<pubDate>Thu, 24 Mar 2011 00:58:25 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=1338#p1338</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=1061#p1061</link>
			<description><![CDATA[<p>Hi there,</p><p>I&#039;ve a question about thr &quot;FormErrors&quot; décorator, so : </p><div class="codebox"><pre><code>        $this-&gt;setDecorators(array(
            array(&#039;FormErrors&#039;, array()),           
            &#039;FormElements&#039;,
            array(&#039;HtmlTag&#039;, array(&#039;tag&#039; =&gt; &#039;table&#039;, &#039;class&#039;=&gt; &#039;table_edit_news&#039;)),
            &#039;Form&#039;
        ));</code></pre></div><p>This code generate the html, <a href="http://framework.zend.com/manual/en/zend.form.standardDecorators.html">accordding the ZF website</a>&#160; : </p><div class="codebox"><pre><code>&lt;ul class=&quot;form-errors&gt;
  &lt;li&gt;&lt;b&gt;[element label or name]&lt;/b&gt;
  &lt;ul&gt;
          &lt;li&gt;[error message]&lt;/li&gt;
          &lt;li&gt;[error message]&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;</code></pre></div><p>How can I remove the [element label or name] line : &lt;b&gt;[element label or name]&lt;/b&gt;<br />I&#160; know I can modify &quot;markupElementLabelStart &quot; and &quot;markupElementLabelEnd &quot; but not remove. In fact, I want only the list of errors, in the &quot;FormErrors&quot; decorator.</p><p>Any idea ?</p><p>Regards,<br />Fabrice</p>]]></description>
			<author><![CDATA[dummy@example.com (__fabrice)]]></author>
			<pubDate>Tue, 14 Sep 2010 20:31:54 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=1061#p1061</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=929#p929</link>
			<description><![CDATA[<p>Ok. I did&#039;t get something.<br />in my source i have <br />&lt;label...<br />&lt;input ...</p><p>&lt;label ...<br />&lt;input... </p><p>so when when i decorate, i wrap and wrap and wrap..<br />but what if i want my labels to be on a row and my elements to be on another row so it will be like</p><p>&lt;tr&gt;&lt;td&gt;&lt;label&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;label&gt;&lt;/label&gt;&lt;/td&gt;&lt;/tr&gt;<br />&lt;tr&gt;&lt;td&gt;&lt;input/&gt;&lt;/td&gt;&lt;td&gt;&lt;input/&gt;&lt;td&gt;&lt;/tr&gt;<br />how is this going to happen? I can&#039;t figure it out :S</p>]]></description>
			<author><![CDATA[dummy@example.com (SocialEvil)]]></author>
			<pubDate>Tue, 29 Jun 2010 04:54:26 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=929#p929</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=884#p884</link>
			<description><![CDATA[<p>if I wanted to insert errors without &#039;ul&#039; and &#039;li&#039;</p>]]></description>
			<author><![CDATA[dummy@example.com (alessio)]]></author>
			<pubDate>Fri, 04 Jun 2010 10:40:03 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=884#p884</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=731#p731</link>
			<description><![CDATA[<div class="quotebox"><cite>Jon Lebensold wrote:</cite><blockquote><div><p>just include the &quot;FormErrors&quot; decorator! <img src="http://www.zendcasts.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p></div></blockquote></div><p>That&#039;s excactly what I tried to do.&#160; &#039;Errors&#039; shouldn&#039;t be any different than &#039;Label&#039;.&#160; So this is what I did:</p><div class="codebox"><pre><code>$this-&gt;setElementDecorators(array( 
       ‘ViewHelper ‘,
       array( &#039;Errors&#039;,
              array( &#039;tag&#039; =&gt; &#039;td&#039;, &#039;placement&#039; =&gt; &#039;APPEND&#039; ),
        array(
            array( ‘data‘ =&gt; ‘HtmlTag‘), 
            array( ‘tag‘ =&gt; ‘td‘,‘class‘ =&gt; ‘element‘ ) 
       ),
       array( ‘Label‘, 
           array( ‘tag‘ =&gt; ‘td‘ )
       ),
       array(
            array(‘row‘ =&gt; ‘HtmlTag‘), 
            array( ‘tag‘ =&gt; ‘tr‘,‘class‘ =&gt; ‘row-element‘ )
       ) 
) );</code></pre></div><p>In my head, it should be no different adding a td tag to the errors than to the label.&#160; But my head does not always compute with Zend and in this case, what this does is adding an attribute to the ul element called td.</p><p>So where should I manipulate the Error decorator?&#160; I want it to render itself the same ( ul -&gt; li ), but I want it to have an additional td around the ul.</p>]]></description>
			<author><![CDATA[dummy@example.com (zormi)]]></author>
			<pubDate>Mon, 22 Mar 2010 12:35:18 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=731#p731</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=718#p718</link>
			<description><![CDATA[<p>I believe I discovered the flaw but falls in further questions. According to this link:</p><p><a href="http://framework.zend.com/wiki/display/ZFFAQ/Forms">http://framework.zend.com/wiki/display/ZFFAQ/Forms</a></p><p>It needs another decorator, following the example shown in zendcast 47 I can not put the two (File and viewhelp) decorators together. Does anyone have any suggestions?</p><p>Thank you.</p>]]></description>
			<author><![CDATA[dummy@example.com (rafaelcavalcanti)]]></author>
			<pubDate>Sun, 14 Mar 2010 13:38:42 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=718#p718</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=712#p712</link>
			<description><![CDATA[<p>I faced some problems when I used the type &#039;file&#039;.<br />At first showed the error:<br />&quot;Warning: Exception caught by form: No file found ... decorator unable to render file element&quot;<br />Simply place the decorator &#039;File&#039;.</p><p>But from now shows another error:</p><p>Warning: Exception caught by form: Method getMaxFileSize does not exist</p><p>And I stopped here ever since. I tried several configurations:</p><p>&#160; &#160; &#160; &#160; $ maxfilesize = new Zend_Form_Element_Hidden ( &#039;form element&#039;);<br />&#160; &#160; &#160; &#160; $ maxfilesize-&gt; setValue (204800);</p><p>&#160; &#160;$ photo = new Zend_Form_Element_File ( &#039;photo&#039;);<br />&#160; &#160; &#160; &#160; $ photo-&gt; setLabel ( &#039;Photo&#039;)<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;-&gt; setValidators (array (<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; array ( &#039;Count&#039;, false, 1),<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; array ( &#039;Size&#039;, false, 204800),<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; array ( &#039;Extension&#039;, false, &#039;jpg, gif, png&#039;),<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; array ( &#039;NotEmpty&#039;, true)<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; ))<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; / / -&gt; setMaxFileSize (20000)<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; -&gt; setRequired (true);</p><p>But still without success. Is there opportunity to help with this?<br />Thank you.<br />Att</p>]]></description>
			<author><![CDATA[dummy@example.com (rafaelcavalcanti)]]></author>
			<pubDate>Tue, 09 Mar 2010 21:03:33 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=712#p712</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=679#p679</link>
			<description><![CDATA[<p>just include the &quot;FormErrors&quot; decorator! <img src="http://www.zendcasts.com/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Jon Lebensold)]]></author>
			<pubDate>Thu, 25 Feb 2010 14:32:28 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=679#p679</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=674#p674</link>
			<description><![CDATA[<p>Thanks for your useful videos. <br />i want to know how can i decorate error message?<br />and may you create a tutorial about implement WYSIWYG editors on zend framework?</p>]]></description>
			<author><![CDATA[dummy@example.com (ulduz114)]]></author>
			<pubDate>Wed, 24 Feb 2010 20:35:50 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=674#p674</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=673#p673</link>
			<description><![CDATA[<p>Jon,</p><p>Thanks for this informative video.&#160; I cannot wait to see your video about custom decorators.</p>]]></description>
			<author><![CDATA[dummy@example.com (kobescoresagain)]]></author>
			<pubDate>Wed, 24 Feb 2010 14:07:04 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=673#p673</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=672#p672</link>
			<description><![CDATA[<p>Finally someone explain in good old english how the damn Decorators works.<br />The Zend_Form_Decorators are a mixed of the Decorator and Strategy Patterns, I believe, the concept is simple but it is hard to get.<br />Jon you&#039;re the man.<br />Thanks</p>]]></description>
			<author><![CDATA[dummy@example.com (rpsimao)]]></author>
			<pubDate>Tue, 23 Feb 2010 22:27:37 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=672#p672</guid>
		</item>
		<item>
			<title><![CDATA[Re: ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=671#p671</link>
			<description><![CDATA[<p>Wow what a nice video! I much prefer this style then the other ones. Personnaly I dont really need help coding little functionnality in my websites but a indepth look at a ZF element like form decorators is really great and saves me the hassle of having to discover it all by myself. <br />I&#039;ll try to implement this. As of now I use forms and ViewScript to display custom forms. It works well but it doubles the code I have to write. <br />Keep up the good work!</p>]]></description>
			<author><![CDATA[dummy@example.com (iznogood)]]></author>
			<pubDate>Tue, 23 Feb 2010 17:46:21 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=671#p671</guid>
		</item>
		<item>
			<title><![CDATA[ZC47 – Zend_Form Decorators Explained]]></title>
			<link>http://www.zendcasts.com/forum/viewtopic.php?pid=669#p669</link>
			<description><![CDATA[<p>One of the pain points for folks who are starting to work with the Zend Framework is the Decorating functionality found in the depths of Zend_Form. I&#039;ve witnessed countless instances when a developer becomes excited by Zend_Form&#039;s easy-to-implement form validation and creation, only to become frustrated by countless hours of fighting with Zend_Form_Decorators. This video is a humble attempt on my part to walk through how Zend_Form Decorators work and how you can reason your way through a desire result. I couldn&#039;t have gotten my own head around this implementation of the decorator pattern without <a href="http://weierophinney.net/matthew/plugin/tag/decorators">Matthew Weier O&#039;Phinney&#039;s excellent posts</a> and <a href="http://devzone.zend.com/article/3450">his original devzone article</a>.</p><p>I&#039;ll show you a bit about how Zend_Form_Decorators are constructed and how to take the default zend_form layout and transform it into a table.</p><p>Grab a <a href="http://zendcasts.googlecode.com/svn/trunk/zc47-zend-form-decorators-explained/zc47-zend-form-decorators-explained.zip">copy of the project</a> or <a href="http://code.google.com/p/zendcasts/source/browse/#svn/trunk/zc47-zend-form-decorators-explained">browse the repository</a>.</p>]]></description>
			<author><![CDATA[dummy@example.com (Jon Lebensold)]]></author>
			<pubDate>Mon, 22 Feb 2010 17:06:46 +0000</pubDate>
			<guid>http://www.zendcasts.com/forum/viewtopic.php?pid=669#p669</guid>
		</item>
	</channel>
</rss>

