


<?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>Learn DooPHP &#187; DooForm</title>
	<atom:link href="http://learn.doophp.com/tag/dooform/feed/" rel="self" type="application/rss+xml" />
	<link>http://learn.doophp.com</link>
	<description>Learn DooPHP - a high performance MVC based PHP framework</description>
	<lastBuildDate>Thu, 18 Aug 2011 19:47:45 +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>DooForm learn to work with forms</title>
		<link>http://learn.doophp.com/2009/09/dooform-learn-to-work-with-forms/</link>
		<comments>http://learn.doophp.com/2009/09/dooform-learn-to-work-with-forms/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 23:04:24 +0000</pubDate>
		<dc:creator>Milos Kovacki</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[captcha]]></category>
		<category><![CDATA[difficult]]></category>
		<category><![CDATA[DooForm]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=107</guid>
		<description><![CDATA[<p>Ok in this tutorial I will show you how do you work with forms, its very simple.<br />
Loading DooForm helper is very easy:</p>
<pre class="brush: php;">
Doo::loadHelper('DooForm');
</pre>
<p>First you create form from array and then just call</p>
<pre class="brush: php;">echo $form-&#62;render();</pre>
<p>To render the form, render function is returning html of the form. So we will begin making one simple element, lets say textfield:</p>
<pre class="brush: php;">$form = new DooForm(array(
    'method' =&#62; 'post',
    'action' =&#62; $action,
    'elements' =&#62; array(
        'username' =&#62; array('text', array(
            'required' =&#62; true,
            'label' =&#62; 'My username: ',
            'attributes' =&#62; array(&#34;style&#34; =&#62; 'border:1px solid #000;', 'class' =&#62; 'username-field'),
            'field-wrapper' =&#62; 'div',
            'validators' =&#62; array(
                array('username',4,7),
                array('maxlength',6,'This is too long'),
                array('minlength',6)
             )
        ))
    )
));</pre>
<p>As you can see all form data you can add into form array, so when you are creating form you will have to define method, action and elements you have in your form, elemnts is another array, that array will contain all form elements. You begin with naming your element and then create array that will describe that element (type, label, validators, field-wrappers, etc&#8230;)</p>
<p>So in element you will have for example:</p>
<pre class="brush: php;">

'username' =&#62; array('text', array(
    'required' =&#62; true,
    'label' =&#62; 'My username: ',
    'attributes' =&#62; array(&#34;style&#34; =&#62; 'border:1px solid #000;', 'class' =&#62; 'mitar'),
    'field-wrapper' =&#62; 'div',
    'validators' =&#62; array(
        array('username',4,7),
        array('maxlength',6,'This is too long'),
        array('minlength',6))
    )
),</pre>
<p>So</p>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/09/dooform-learn-to-work-with-forms/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
