<?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/"
		>
<channel>
	<title>Comments on: Zend Framework and hidden fields</title>
	<atom:link href="http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/</link>
	<description>skillz...i has them</description>
	<lastBuildDate>Thu, 09 Sep 2010 16:17:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: LC</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1374</link>
		<dc:creator>LC</dc:creator>
		<pubDate>Thu, 17 Jun 2010 10:42:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1374</guid>
		<description>I use ...

-&gt;removeDecorator(&#039;label&#039;)
-&gt;removeDecorator(&#039;HtmlTag&#039;);

... stacked and it works, for hidden and hash elements.

I don&#039;t care if it does not validate.</description>
		<content:encoded><![CDATA[<p>I use &#8230;</p>
<p>-&gt;removeDecorator(&#8216;label&#8217;)<br />
-&gt;removeDecorator(&#8216;HtmlTag&#8217;);</p>
<p>&#8230; stacked and it works, for hidden and hash elements.</p>
<p>I don&#8217;t care if it does not validate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Exception e</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1280</link>
		<dc:creator>Exception e</dc:creator>
		<pubDate>Tue, 20 Apr 2010 13:44:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1280</guid>
		<description>@Iacovos Constantinou Thank you!</description>
		<content:encoded><![CDATA[<p>@Iacovos Constantinou Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iacovos Constantinou</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1270</link>
		<dc:creator>Iacovos Constantinou</dc:creator>
		<pubDate>Wed, 31 Mar 2010 17:53:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1270</guid>
		<description>You should use ViewHelper and HtmlTag decorators in order to achieve this. The following piece of code will completely ignore the label tag (incl. the dl) and it will generate both the dd and input tags.

&lt;pre lang=&quot;php&quot;&gt;
class Zend_View_Helper_StripHidden {
    public function stripHidden( Zend_Form $_form ) {
        foreach( $_form-&gt;getElements() as $element ) {
            if( $element instanceof Zend_Form_Element_Hidden ) {
				$element-&gt;setDecorators(array(
				    &#039;ViewHelper&#039;,
				    array(&#039;HtmlTag&#039;, array(&#039;tag&#039; =&gt; &#039;dd&#039;, &#039;class&#039; =&gt;&#039;hidden&#039;)),
				));
            }
        }
      
        return $_form;
    }
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>You should use ViewHelper and HtmlTag decorators in order to achieve this. The following piece of code will completely ignore the label tag (incl. the dl) and it will generate both the dd and input tags.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Zend_View_Helper_StripHidden <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> stripHidden<span style="color: #009900;">&#40;</span> Zend_Form <span style="color: #000088;">$_form</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$element</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$element</span> instanceof Zend_Form_Element_Hidden <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDecorators</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
				    <span style="color: #0000ff;">'ViewHelper'</span><span style="color: #339933;">,</span>
				    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HtmlTag'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tag'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'dd'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'hidden'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$_form</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Exception e</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1266</link>
		<dc:creator>Exception e</dc:creator>
		<pubDate>Fri, 26 Mar 2010 15:49:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1266</guid>
		<description>@Tudor with &quot;last solution&quot;  I meant your comment above http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1053</description>
		<content:encoded><![CDATA[<p>@Tudor with &#8220;last solution&#8221;  I meant your comment above <a href="http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1053" rel="nofollow">http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1053</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Exception e</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1265</link>
		<dc:creator>Exception e</dc:creator>
		<pubDate>Fri, 26 Mar 2010 15:33:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1265</guid>
		<description>@Tudor Your last solution will still generate dt&#039;s without a class. At best it will add a class to the  inside the .

Could you confirm this, or did you prepare your elements in a special way (changing the decorators etc).</description>
		<content:encoded><![CDATA[<p>@Tudor Your last solution will still generate dt&#8217;s without a class. At best it will add a class to the  inside the .</p>
<p>Could you confirm this, or did you prepare your elements in a special way (changing the decorators etc).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tudor</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1053</link>
		<dc:creator>Tudor</dc:creator>
		<pubDate>Thu, 21 Jan 2010 11:37:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1053</guid>
		<description>The way that the form&#039;s widgets are rendered - with an extra CSS class in my case - is a presentation issue, that&#039;s why I went for the view helper approach.

But, of course, one can take the best of both worlds and do it like:

&lt;pre lang=&quot;php&quot;&gt;
public function render(Zend_View_Interface $view = null) {
    foreach($this-&gt;getElements() as $element) {
        if($element instanceof Zend_Form_Element_Hidden) {
            foreach($element-&gt;getDecorators() as $decorator) {
                $decorator-&gt;setOption(&#039;class&#039;, &#039;hidden&#039;);
            }
        }
    }

    return parent::render($view);
}
&lt;/pre&gt;

This will yield valid XHTML code and reside in the parent form. It&#039;s not a matter of right or wrong, but rather of personal opinions on design patterns.</description>
		<content:encoded><![CDATA[<p>The way that the form&#8217;s widgets are rendered &#8211; with an extra CSS class in my case &#8211; is a presentation issue, that&#8217;s why I went for the view helper approach.</p>
<p>But, of course, one can take the best of both worlds and do it like:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> render<span style="color: #009900;">&#40;</span>Zend_View_Interface <span style="color: #000088;">$view</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$element</span> instanceof Zend_Form_Element_Hidden<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDecorators</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$decorator</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$decorator</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setOption</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'hidden'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">return</span> parent<span style="color: #339933;">::</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$view</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This will yield valid XHTML code and reside in the parent form. It&#8217;s not a matter of right or wrong, but rather of personal opinions on design patterns.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Slam</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1051</link>
		<dc:creator>Slam</dc:creator>
		<pubDate>Wed, 20 Jan 2010 08:19:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1051</guid>
		<description>Forms are not properly in one letter of the MVC acronym, forms are forms, in fact in a form you manage the Model/Control of a form (validators, &#039;required&#039; etc) and also the View (decorators, label, etc), so i think that is right and legitimate to manipulate all form properties directly in form classes.

Moreover, that implementation skimp lines of code and new classes creation with the same results and no different business logic nor logic error.

Btw, this is my interpretation.</description>
		<content:encoded><![CDATA[<p>Forms are not properly in one letter of the MVC acronym, forms are forms, in fact in a form you manage the Model/Control of a form (validators, &#8216;required&#8217; etc) and also the View (decorators, label, etc), so i think that is right and legitimate to manipulate all form properties directly in form classes.</p>
<p>Moreover, that implementation skimp lines of code and new classes creation with the same results and no different business logic nor logic error.</p>
<p>Btw, this is my interpretation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tudor</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1050</link>
		<dc:creator>Tudor</dc:creator>
		<pubDate>Wed, 20 Jan 2010 07:21:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1050</guid>
		<description>Slam&gt; You just add &lt;pre lang=&quot;php&quot;&gt;code&lt;/pre&gt;. I&#039;ve edited you comment and added the proper highlighting. The whole idea is keeping the outputted html clean and standards compliant.

And, as always, there are more than one ways to get things done and people adhere to different philosophies. I&#039;ve used the view helper approach because this is a presentation issue (how the form will be displayed) and presentation logic should stay at the &quot;view level&quot; of the MVC paradigm.</description>
		<content:encoded><![CDATA[<p>Slam> You just add &lt;pre lang=&#8221;php&#8221;&gt;code&lt;/pre&gt;. I&#8217;ve edited you comment and added the proper highlighting. The whole idea is keeping the outputted html clean and standards compliant.</p>
<p>And, as always, there are more than one ways to get things done and people adhere to different philosophies. I&#8217;ve used the view helper approach because this is a presentation issue (how the form will be displayed) and presentation logic should stay at the &#8220;view level&#8221; of the MVC paradigm.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Slam</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-1049</link>
		<dc:creator>Slam</dc:creator>
		<pubDate>Tue, 19 Jan 2010 16:45:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-1049</guid>
		<description>Fixing this problem with a View Helper is a waste of time imho.

I created a mother class (that extends Zend_From) for all my forms, and rewritten render() function:
&lt;pre lang=&quot;php&quot;&gt;
public function render(Zend_View_Interface $view = null)
{
	foreach ($this-&gt;getElements() as $element) {
		if ($element instanceof Zend_Form_Element_Hidden) {
			$element-&gt;setDecorators(array(&#039;ViewHelper&#039;));
		}
	}
	
	return parent::render($view);
}
&lt;/pre&gt;
So no different code is written in forms or views.
You can use even Tudor solution with my implementation.

P.S.: Tudor, make possible and easily visibile for all how to &lt;code&gt; comment code plz.</description>
		<content:encoded><![CDATA[<p>Fixing this problem with a View Helper is a waste of time imho.</p>
<p>I created a mother class (that extends Zend_From) for all my forms, and rewritten render() function:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> render<span style="color: #009900;">&#40;</span>Zend_View_Interface <span style="color: #000088;">$view</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getElements</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$element</span> instanceof Zend_Form_Element_Hidden<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDecorators</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ViewHelper'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> parent<span style="color: #339933;">::</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$view</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>So no different code is written in forms or views.<br />
You can use even Tudor solution with my implementation.</p>
<p>P.S.: Tudor, make possible and easily visibile for all how to <code> comment code plz.</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tudor</title>
		<link>http://blog.motane.lu/2009/02/17/zend-framework-and-hidden-fields/comment-page-1/#comment-979</link>
		<dc:creator>Tudor</dc:creator>
		<pubDate>Mon, 28 Dec 2009 20:18:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.motane.lu/?p=275#comment-979</guid>
		<description>That will generate invalid xhtml...see few comments above! I want my pages to validate...</description>
		<content:encoded><![CDATA[<p>That will generate invalid xhtml&#8230;see few comments above! I want my pages to validate&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
