<?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: Zebra_Form, a jQuery augmented PHP library for creating and validating HTML forms</title>
	<atom:link href="http://stefangabos.ro/php-libraries/zebra-form/feed/" rel="self" type="application/rss+xml" />
	<link>http://stefangabos.ro</link>
	<description>web developer extraordinaire</description>
	<lastBuildDate>Thu, 17 May 2012 13:19:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Stefan Gabos</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-12/#comment-1422</link>
		<dc:creator>Stefan Gabos</dc:creator>
		<pubDate>Wed, 16 May 2012 13:48:41 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1422</guid>
		<description>by all means: use custom templates!</description>
		<content:encoded><![CDATA[<p>by all means: use custom templates!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Allan</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-12/#comment-1421</link>
		<dc:creator>Allan</dc:creator>
		<pubDate>Wed, 16 May 2012 13:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1421</guid>
		<description>Thanks Stefan but I think you missed 1 big point. I don&#039;t know what the checkboxes will be because they are dynamic (generated from records in a database that change over time. some stay. some go. some are selected for the particular situation. etc)

Using the *horizontal or *vertical layout works fine, but I need a more customized layout. What would be useful is if an array could be passed to the template instead of the particular multiple variables.

eg instead of $label_checkbox_1 and $checkbox_1 etc could we please get $label_checkbox[&#039;1&#039;] and $checkbox[&#039;1&#039;]. That way we could simple foreach through the array.</description>
		<content:encoded><![CDATA[<p>Thanks Stefan but I think you missed 1 big point. I don&#8217;t know what the checkboxes will be because they are dynamic (generated from records in a database that change over time. some stay. some go. some are selected for the particular situation. etc)</p>
<p>Using the *horizontal or *vertical layout works fine, but I need a more customized layout. What would be useful is if an array could be passed to the template instead of the particular multiple variables.</p>
<p>eg instead of $label_checkbox_1 and $checkbox_1 etc could we please get $label_checkbox['1'] and $checkbox['1']. That way we could simple foreach through the array.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raphaël</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-12/#comment-1419</link>
		<dc:creator>Raphaël</dc:creator>
		<pubDate>Wed, 16 May 2012 07:59:41 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1419</guid>
		<description>Found a little bug on your include Button.php you definied
&#039;type&#039; =&gt; &#039;submit&#039; but submit type is already exist with submit class and cause some problem for guy only need normal button :p.</description>
		<content:encoded><![CDATA[<p>Found a little bug on your include Button.php you definied<br />
&#8216;type&#8217; =&gt; &#8216;submit&#8217; but submit type is already exist with submit class and cause some problem for guy only need normal button :p.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Gabos</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-12/#comment-1418</link>
		<dc:creator>Stefan Gabos</dc:creator>
		<pubDate>Wed, 16 May 2012 04:42:35 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1418</guid>
		<description>the way I do it is to put all the controls I need on the page right from the start, with all the needed rules attached. From jQuery I can easily control what&#039;s visible and when, and rely on the fact Zebra_Form will not do client-side validation on elements that have &quot;display:none&quot; or &quot;visibility:hidden&quot;. 

The problem is that if client-side validation is done and ok, the form will submit but in PHP you will not know which elements were hidden BUT you know all the values that were submitted. So, the trick is that when you create the form, attach rules based on value of $_POST like:

&lt;pre&gt;&lt;code&gt;// we have a random checkbox
$form-&gt;add(&#039;checkbox&#039;, &#039;mycheckbox&#039;, 1);

// this second checkbox is required only if the first one is 
// selected; whether this checkbox is visible or not is 
// controlled from jQuery
$obj = &amp;$form-&gt;add(
  &#039;checkbox&#039;, 
  &#039;myothercheckbox&#039;, 
  2, 
  array(&#039;style&#039; =&gt; &#039;display:none&#039;)
);

if (
  isset($_POST[&#039;mycheckbox&#039;]) &amp;&amp; 
  $_POST[&#039;mycheckbox&#039;] == 1
) {

  $obj-&gt;set_attributes(array(&#039;style&#039; =&gt; &#039;display:block&#039;));

  $obj-&gt;set_rule(array(
    &#039;required&#039; =&gt; array(&#039;error&#039;, &#039;Some error&#039;);
  ));

);&lt;/code&gt;&lt;/pre&gt;

I hope this makes sense</description>
		<content:encoded><![CDATA[<p>the way I do it is to put all the controls I need on the page right from the start, with all the needed rules attached. From jQuery I can easily control what&#8217;s visible and when, and rely on the fact Zebra_Form will not do client-side validation on elements that have &#8220;display:none&#8221; or &#8220;visibility:hidden&#8221;. </p>
<p>The problem is that if client-side validation is done and ok, the form will submit but in PHP you will not know which elements were hidden BUT you know all the values that were submitted. So, the trick is that when you create the form, attach rules based on value of $_POST like:</p>
<pre><code>// we have a random checkbox
$form->add('checkbox', 'mycheckbox', 1);

// this second checkbox is required only if the first one is
// selected; whether this checkbox is visible or not is
// controlled from jQuery
$obj = &#038;$form->add(
  'checkbox',
  'myothercheckbox',
  2,
  array('style' => 'display:none')
);

if (
  isset($_POST['mycheckbox']) &#038;&#038;
  $_POST['mycheckbox'] == 1
) {

  $obj->set_attributes(array('style' => 'display:block'));

  $obj->set_rule(array(
    'required' => array('error', 'Some error');
  ));

);</code></pre>
<p>I hope this makes sense</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Allan</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-12/#comment-1417</link>
		<dc:creator>Allan</dc:creator>
		<pubDate>Wed, 16 May 2012 01:07:09 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1417</guid>
		<description>I see that this has been asked before but was never answered.

I need to use a custom form with dynamic checkboxes but cannot work out how to display them.

ie I have $label_checkbox_1 and $checkbox_1 but I might also have $label_checkbox_2 and $checkbox_2 or $label_checkbox_5 and $checkbox_5</description>
		<content:encoded><![CDATA[<p>I see that this has been asked before but was never answered.</p>
<p>I need to use a custom form with dynamic checkboxes but cannot work out how to display them.</p>
<p>ie I have $label_checkbox_1 and $checkbox_1 but I might also have $label_checkbox_2 and $checkbox_2 or $label_checkbox_5 and $checkbox_5</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raphaël</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-11/#comment-1416</link>
		<dc:creator>Raphaël</dc:creator>
		<pubDate>Tue, 15 May 2012 14:53:11 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1416</guid>
		<description>Finally i&#039;m just like an blind man i&#039;ve found the way to do custom template at second i post my question XD.
So great job with that library :)</description>
		<content:encoded><![CDATA[<p>Finally i&#8217;m just like an blind man i&#8217;ve found the way to do custom template at second i post my question XD.<br />
So great job with that library <img src='http://stefangabos.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raphaël</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-11/#comment-1415</link>
		<dc:creator>Raphaël</dc:creator>
		<pubDate>Tue, 15 May 2012 14:50:50 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1415</guid>
		<description>Hello,
your library is just beautiful work.
so i&#039;ve just a little question.
is it possibly to get like two button or two field in the same row and not one under another?

this thing would be great i think ( or maybe i have missed this functionnality ^^)</description>
		<content:encoded><![CDATA[<p>Hello,<br />
your library is just beautiful work.<br />
so i&#8217;ve just a little question.<br />
is it possibly to get like two button or two field in the same row and not one under another?</p>
<p>this thing would be great i think ( or maybe i have missed this functionnality ^^)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Gabos</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-11/#comment-1406</link>
		<dc:creator>Stefan Gabos</dc:creator>
		<pubDate>Sat, 12 May 2012 19:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1406</guid>
		<description>thanks a lot! i&#039;ve patched the bug and the patched version is now available for download. your name is in the changelog now! :)</description>
		<content:encoded><![CDATA[<p>thanks a lot! i&#8217;ve patched the bug and the patched version is now available for download. your name is in the changelog now! <img src='http://stefangabos.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edward</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-11/#comment-1405</link>
		<dc:creator>Edward</dc:creator>
		<pubDate>Sat, 12 May 2012 00:53:20 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1405</guid>
		<description>Wouldn&#039;t you know, as soon as I sent this I came upon the custom validation. Does exactly what I need. Please disregard my previous message and I promise I&#039;ll look a little harder next time.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t you know, as soon as I sent this I came upon the custom validation. Does exactly what I need. Please disregard my previous message and I promise I&#8217;ll look a little harder next time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edward</title>
		<link>http://stefangabos.ro/php-libraries/zebra-form/comment-page-11/#comment-1404</link>
		<dc:creator>Edward</dc:creator>
		<pubDate>Sat, 12 May 2012 00:33:39 +0000</pubDate>
		<guid isPermaLink="false">http://stefangabos.ro/?page_id=649#comment-1404</guid>
		<description>I would like to get your insight into dynamically setting or removing validation rules. Here&#039;s what I&#039;m trying to do. I have a select box with some options. If the first option is selected, I&#039;d like another select box to appear with choices related to that selection. If the second option is selected, I&#039;d like 2 text boxes to appear where the user can enter more information. I have this functionality working OK. I get the select box or text boxes appearing and disappearing when they should. 

The problem is with validation. If the first option is selected, then I&#039;d like the second appearing select box to be required. If the second option is selected, then I&#039;d like both appearing text boxes to be required. I can set the validation rule for all of them to be required initially, but when the form is submitted, even if one of these controls is still hidden, then it generates a validation error. So what I&#039;d like to do is be able to set a validation rule for a control when it&#039;s visible and remove it when it&#039;s not. You&#039;re doing something similar with the &#039;other&#039; text box that appears when Other... is selected from a select box. Can I do something similar as I&#039;ve described? Or can I use javascript to get at your validation_rules object so I can set and unset rules dynamically? Thanks for any thoughts you might have. I appreciate how good you are about responding to these things.  -Edward.</description>
		<content:encoded><![CDATA[<p>I would like to get your insight into dynamically setting or removing validation rules. Here&#8217;s what I&#8217;m trying to do. I have a select box with some options. If the first option is selected, I&#8217;d like another select box to appear with choices related to that selection. If the second option is selected, I&#8217;d like 2 text boxes to appear where the user can enter more information. I have this functionality working OK. I get the select box or text boxes appearing and disappearing when they should. </p>
<p>The problem is with validation. If the first option is selected, then I&#8217;d like the second appearing select box to be required. If the second option is selected, then I&#8217;d like both appearing text boxes to be required. I can set the validation rule for all of them to be required initially, but when the form is submitted, even if one of these controls is still hidden, then it generates a validation error. So what I&#8217;d like to do is be able to set a validation rule for a control when it&#8217;s visible and remove it when it&#8217;s not. You&#8217;re doing something similar with the &#8216;other&#8217; text box that appears when Other&#8230; is selected from a select box. Can I do something similar as I&#8217;ve described? Or can I use javascript to get at your validation_rules object so I can set and unset rules dynamically? Thanks for any thoughts you might have. I appreciate how good you are about responding to these things.  -Edward.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

