<?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: Phorms: a PHP form library</title>
	<atom:link href="http://www.artfulcode.net/articles/phorms-a-php-form-library/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/</link>
	<description>Resources and tips for dynamic, interactive languages.</description>
	<lastBuildDate>Mon, 23 Jan 2012 14:26:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Mosselman</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-3404</link>
		<dc:creator>Mosselman</dc:creator>
		<pubDate>Thu, 18 Aug 2011 18:32:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-3404</guid>
		<description>Cool library! Thanks for making it, it saves a lot of trouble when you fall back to not using a php-framework for a change. Great fun to use different libraries, and I use yours for forms.

Something that would be cool too is supporting HTML5, seeing as it is getting bigger and bigger. The way I work around it at the moment is changing the serialize function of a text-field for example, to:

&lt;code&gt;	protected function serialize($value, array $attributes=array())
	{
		$attributes[&#039;type&#039;] = (!isset($attributes[&#039;type&#039;])) ? &#039;text&#039; : $attributes[&#039;type&#039;];
		return parent::serialize($value, $attributes);
	}&lt;/code&gt;

Note the place where &#039;type&#039; is set. This used to be: 
&lt;code&gt;
$attributes[&#039;type&#039;] = &#039;text&#039;;
&lt;/code&gt;

This meant that whatever type you gave in the definition of the field, it would still use &#039;text&#039;. Now you can override it if needed.

The update of the library that I have in mind would be to alter it to check if HTML5 is supported and use the HTML5 attributes. &#039;required&#039; would be a great one to support too.

Thanks again!</description>
		<content:encoded><![CDATA[<p>Cool library! Thanks for making it, it saves a lot of trouble when you fall back to not using a php-framework for a change. Great fun to use different libraries, and I use yours for forms.</p>
<p>Something that would be cool too is supporting HTML5, seeing as it is getting bigger and bigger. The way I work around it at the moment is changing the serialize function of a text-field for example, to:</p>
<p><code>	protected function serialize($value, array $attributes=array())<br />
	{<br />
		$attributes['type'] = (!isset($attributes['type'])) ? 'text' : $attributes['type'];<br />
		return parent::serialize($value, $attributes);<br />
	}</code></p>
<p>Note the place where &#8216;type&#8217; is set. This used to be:<br />
<code><br />
$attributes['type'] = 'text';<br />
</code></p>
<p>This meant that whatever type you gave in the definition of the field, it would still use &#8216;text&#8217;. Now you can override it if needed.</p>
<p>The update of the library that I have in mind would be to alter it to check if HTML5 is supported and use the HTML5 attributes. &#8216;required&#8217; would be a great one to support too.</p>
<p>Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: benson</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-2053</link>
		<dc:creator>benson</dc:creator>
		<pubDate>Sun, 30 May 2010 16:08:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-2053</guid>
		<description>I have found the following bug:
fields.php line 540, the string should be quoted using double quote instead of single quote
This leads to incorrect error message when having input with length greater than the required max_length.</description>
		<content:encoded><![CDATA[<p>I have found the following bug:<br />
fields.php line 540, the string should be quoted using double quote instead of single quote<br />
This leads to incorrect error message when having input with length greater than the required max_length.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zeff</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-1978</link>
		<dc:creator>Zeff</dc:creator>
		<pubDate>Sat, 26 Dec 2009 09:15:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-1978</guid>
		<description>Hi, I tried the example_form.php after extracting the phorms tarball, but I&#039;m getting the following error on instantiating the HiddenField class:
&quot;Catchable fatal error: Argument 1 passed to HiddenField::__construct() must be an array, integer given, called in ... \htdocs\phorms\examples\comment_form.php on line 18 and defined in ... \htdocs\phorms\src\fields.php on line 569&quot;.
Indeed an integer (255) is given as argument on line 18 in the comment_form.php script. How to solve it?
Many thanks in advance!
Zeff</description>
		<content:encoded><![CDATA[<p>Hi, I tried the example_form.php after extracting the phorms tarball, but I&#8217;m getting the following error on instantiating the HiddenField class:<br />
&#8220;Catchable fatal error: Argument 1 passed to HiddenField::__construct() must be an array, integer given, called in &#8230; \htdocs\phorms\examples\comment_form.php on line 18 and defined in &#8230; \htdocs\phorms\src\fields.php on line 569&#8243;.<br />
Indeed an integer (255) is given as argument on line 18 in the comment_form.php script. How to solve it?<br />
Many thanks in advance!<br />
Zeff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cesar</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-1963</link>
		<dc:creator>Cesar</dc:creator>
		<pubDate>Sun, 06 Dec 2009 08:38:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-1963</guid>
		<description>Is there a &lt;b&gt;supported&lt;/b&gt; way to make a file upload field optional? 
If the user don&#039;t upload a file, phorms complains, I tried to change it, but keep getting warnings in getimagesize because i don&#039;t throw an exception when there is no file uploaded.



By the way excellent work!!!</description>
		<content:encoded><![CDATA[<p>Is there a <b>supported</b> way to make a file upload field optional?<br />
If the user don&#8217;t upload a file, phorms complains, I tried to change it, but keep getting warnings in getimagesize because i don&#8217;t throw an exception when there is no file uploaded.</p>
<p>By the way excellent work!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bistory</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-1948</link>
		<dc:creator>bistory</dc:creator>
		<pubDate>Wed, 18 Nov 2009 07:40:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-1948</guid>
		<description>I&#039;m writing an extented version of phorms.
It is based on git version of phorms
I supports non-table form (full css), client-side validation (javascript) and I&#039;ll implement fieldsets.

It is still a work in progress but I hope I could be able to release a first beta version soon !</description>
		<content:encoded><![CDATA[<p>I&#8217;m writing an extented version of phorms.<br />
It is based on git version of phorms<br />
I supports non-table form (full css), client-side validation (javascript) and I&#8217;ll implement fieldsets.</p>
<p>It is still a work in progress but I hope I could be able to release a first beta version soon !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: required</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-1947</link>
		<dc:creator>required</dc:creator>
		<pubDate>Wed, 18 Nov 2009 07:14:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-1947</guid>
		<description>looks like django forms</description>
		<content:encoded><![CDATA[<p>looks like django forms</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Krause - view it, code it, share it!</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-1923</link>
		<dc:creator>Christian Krause - view it, code it, share it!</dc:creator>
		<pubDate>Thu, 01 Oct 2009 19:36:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-1923</guid>
		<description>&lt;strong&gt;PHP Phorms &#8211; Form Library...&lt;/strong&gt;

Die Lib wirkte auf den ersten Blick sehr interessant, meine Euphorie wurde jedoch schnell von der etwas seltsamen abstrakten Basis-Klasse getrübt. Der Entwickler hat wohl vorgesehen das jedes Formular durch eine Abgeleitete Klasse dargestellt wird die ...</description>
		<content:encoded><![CDATA[<p><strong>PHP Phorms &#8211; Form Library&#8230;</strong></p>
<p>Die Lib wirkte auf den ersten Blick sehr interessant, meine Euphorie wurde jedoch schnell von der etwas seltsamen abstrakten Basis-Klasse getrübt. Der Entwickler hat wohl vorgesehen das jedes Formular durch eine Abgeleitete Klasse dargestellt wird die &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-1922</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Thu, 01 Oct 2009 14:41:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-1922</guid>
		<description>there is a bug in OptionsField class:
   
public function get_widget()
    {
        return new OptionGroupWidget($this-&gt;options);
    }

must be:

return new OptionGroupWidget($this-&gt;choices);

There is no &quot;RadioGroupWidget&quot; i implemented that:
class RadioGroupWidget extends PhormWidget
{
    /**
     * The options for this field as an array of actual=&gt;display values.
     **/
    private $options;

    /**
     * @author Jeff Ober
     * @param array $options the options as an array of actual=&gt;display values
     * @return null
     **/
    public function __construct(array $options)
    {
        $this-&gt;options = $options;
    }

    /**
     * @author Jeff Ober
     * @param array $value an array of the field&#039;s values
     * @param array $attributes key=&gt;value pairs corresponding to HTML attributes&#039; name=&gt;value
     **/
    public function html($value, array $attributes=array())
    {
        if (is_null($value)) $value = array();

        foreach ($attributes as $key =&gt; $val)
            $attributes[htmlentities( (string)$key )] = htmlentities( (string)$val );

		return $this-&gt;serialize($value, $attributes);
    }

    /**
     * Returns the field as serialized HTML.
     * @author Jeff Ober
     * @param mixed $value the form widget&#039;s value attribute
     * @param array $attributes key=&gt;value pairs corresponding to HTML attributes&#039; name=&gt;value
     * @return string the serialized HTML
     **/
    protected function serialize($value, array $attributes=array())
    {
        $html = &quot;&quot;;
        foreach ($this-&gt;options as $actual =&gt; $display)
        {
            $option = new RadioWidget( in_array($actual, $value) );
            $html .= sprintf(&#039;%s %s&#039;, htmlentities($display), $option-&gt;html($actual, $attributes));
        }

        return $html;
    }
}</description>
		<content:encoded><![CDATA[<p>there is a bug in OptionsField class:</p>
<p>public function get_widget()<br />
    {<br />
        return new OptionGroupWidget($this-&gt;options);<br />
    }</p>
<p>must be:</p>
<p>return new OptionGroupWidget($this-&gt;choices);</p>
<p>There is no &#8220;RadioGroupWidget&#8221; i implemented that:<br />
class RadioGroupWidget extends PhormWidget<br />
{<br />
    /**<br />
     * The options for this field as an array of actual=&gt;display values.<br />
     **/<br />
    private $options;</p>
<p>    /**<br />
     * @author Jeff Ober<br />
     * @param array $options the options as an array of actual=&gt;display values<br />
     * @return null<br />
     **/<br />
    public function __construct(array $options)<br />
    {<br />
        $this-&gt;options = $options;<br />
    }</p>
<p>    /**<br />
     * @author Jeff Ober<br />
     * @param array $value an array of the field&#8217;s values<br />
     * @param array $attributes key=&gt;value pairs corresponding to HTML attributes&#8217; name=&gt;value<br />
     **/<br />
    public function html($value, array $attributes=array())<br />
    {<br />
        if (is_null($value)) $value = array();</p>
<p>        foreach ($attributes as $key =&gt; $val)<br />
            $attributes[htmlentities( (string)$key )] = htmlentities( (string)$val );</p>
<p>		return $this-&gt;serialize($value, $attributes);<br />
    }</p>
<p>    /**<br />
     * Returns the field as serialized HTML.<br />
     * @author Jeff Ober<br />
     * @param mixed $value the form widget&#8217;s value attribute<br />
     * @param array $attributes key=&gt;value pairs corresponding to HTML attributes&#8217; name=&gt;value<br />
     * @return string the serialized HTML<br />
     **/<br />
    protected function serialize($value, array $attributes=array())<br />
    {<br />
        $html = &#8220;&#8221;;<br />
        foreach ($this-&gt;options as $actual =&gt; $display)<br />
        {<br />
            $option = new RadioWidget( in_array($actual, $value) );<br />
            $html .= sprintf(&#8216;%s %s&#8217;, htmlentities($display), $option-&gt;html($actual, $attributes));<br />
        }</p>
<p>        return $html;<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-1877</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Wed, 02 Sep 2009 17:14:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-1877</guid>
		<description>Sorry it took so long for me to reply. It has been a busy few weeks at work. There is not an option-group with radio buttons. It is simple to implement, however.

You can copy the OptionGroupWidget source (widgets.php) and change the line in the `serialize` method:

  $option = new CheckboxWidget ...

to:

  $option = new RadioWidget...

And save it as a RadioOptionGroupWidget or similar.</description>
		<content:encoded><![CDATA[<p>Sorry it took so long for me to reply. It has been a busy few weeks at work. There is not an option-group with radio buttons. It is simple to implement, however.</p>
<p>You can copy the OptionGroupWidget source (widgets.php) and change the line in the `serialize` method:</p>
<p>  $option = new CheckboxWidget &#8230;</p>
<p>to:</p>
<p>  $option = new RadioWidget&#8230;</p>
<p>And save it as a RadioOptionGroupWidget or similar.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bert oost</title>
		<link>http://www.artfulcode.net/articles/phorms-a-php-form-library/comment-page-1/#comment-1788</link>
		<dc:creator>bert oost</dc:creator>
		<pubDate>Wed, 19 Aug 2009 08:14:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.artfulcode.net/?p=587#comment-1788</guid>
		<description>And how will I add an option-group with radio-buttons? It look likes it isn&#039;t implemented... please more information about this feature?</description>
		<content:encoded><![CDATA[<p>And how will I add an option-group with radio-buttons? It look likes it isn&#8217;t implemented&#8230; please more information about this feature?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

