<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>PEAR Forum</title>
  <link>http://www.pear-forum.org/index.php</link>
  <description>PHP Extension and Application Repository</description>
  <language>english</language>
  <copyright>(c) Copyright 2006-2010 by PEAR Forum</copyright>
  <managingEditor>PEAR-forum.org &lt;pear@mowd.nl&gt;</managingEditor>
  <webMaster>PEAR-forum.org &lt;pear@mowd.nl&gt;</webMaster>
  <pubDate>Tue Sep 07, 2010 7:41 pm</pubDate>
  <lastBuildDate>Tue Sep 07, 2010 7:41 pm</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>PEAR Forum</title>
    <url>http://www.pear-forum.org/images/pear-icon.png</url>
    <link>http://www.pear-forum.org/</link>
    <description>PHP Extension and Application Repository</description>
  </image>

                                      <item>
                                        <title>Re: QuickForm - dynamic rules depending on checked radios</title>
                                        <link>http://www.pear-forum.org/viewtopic.php?p=2420#2420</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.pear-forum.org/profile.php?mode=viewprofile&amp;amp;u=2802'&gt;aicos&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed Jul 11, 2007 4:55 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Ok, solved it. Thanks for the help and here is the simplified solution for those interested:&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
function checkother&amp;#40;$elements&amp;#41; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if &amp;#40;$elements&amp;#91;0&amp;#93; == 'radio4'&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#123;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if &amp;#40;$elements&amp;#91;1&amp;#93; ==''&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
registerRule&amp;#40;'othercheck','callback','checkother'&amp;#41;;&lt;br /&gt;
addRule&amp;#40;array&amp;#40;$questionGroup,'radio_text'&amp;#41;,'Please specify other','othercheck'&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
The actual code is more complicated than this, so I left out the lines that add the radios and textbox. But you can assume that there is one group ($questionGroup) containing just 4 radios. This is added to a required rule. Then there is just one textbox ('radio_text') and the custom rule that you can see above.</description>
                                        <comments>http://www.pear-forum.org/viewtopic.php?p=2420#2420</comments>
                                        <author>aicos</author>
                                        <pubDate>Wed Jul 11, 2007 4:55 pm</pubDate>
                                        <guid isPermaLink="true">http://www.pear-forum.org/viewtopic.php?p=2420#2420</guid>
                                      </item>
                                      <item>
                                        <title>Re: QuickForm - dynamic rules depending on checked radios</title>
                                        <link>http://www.pear-forum.org/viewtopic.php?p=2380#2380</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.pear-forum.org/profile.php?mode=viewprofile&amp;amp;u=918'&gt;mark&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Jul 09, 2007 1:34 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;aicos wrote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;Are you saying that I *must* use some client validation to make this work?&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
No, the other way round: You need a server-side rule, but you *can* also add a custom client-side rule.&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;aicos wrote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;I couldn't find any examples that are similar to what I am trying to achieve. Can you point me to the relevant section?&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
You could follow the checkEmail() example on this page:&lt;br /&gt;
&lt;a href=&quot;http://pear.php.net/manual/en/package.html.html-quickform.intro-validation.php&quot; target=&quot;_blank&quot;&gt;http://pear.php.net/manual/en/package.html.html-quickform.intro-validation.php&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
But I'm not sure whether this also works in similar way for group rules.&lt;br /&gt;
&lt;br /&gt;
Another solution would be to use addFormRule(): This allows very customized rules. There is an example available in formrule.php in the docs/examples/ directory.</description>
                                        <comments>http://www.pear-forum.org/viewtopic.php?p=2380#2380</comments>
                                        <author>mark</author>
                                        <pubDate>Mon Jul 09, 2007 1:34 pm</pubDate>
                                        <guid isPermaLink="true">http://www.pear-forum.org/viewtopic.php?p=2380#2380</guid>
                                      </item>
                                      <item>
                                        <title>Re: QuickForm - dynamic rules depending on checked radios</title>
                                        <link>http://www.pear-forum.org/viewtopic.php?p=2378#2378</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.pear-forum.org/profile.php?mode=viewprofile&amp;amp;u=2802'&gt;aicos&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Jul 09, 2007 11:45 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Are you saying that I *must* use some client validation to make this work? &lt;br /&gt;
&lt;br /&gt;
I couldn't find any examples that are similar to what I am trying to achieve. Can you point me to the relevant section? &lt;br /&gt;
&lt;br /&gt;
Thanks</description>
                                        <comments>http://www.pear-forum.org/viewtopic.php?p=2378#2378</comments>
                                        <author>aicos</author>
                                        <pubDate>Mon Jul 09, 2007 11:45 am</pubDate>
                                        <guid isPermaLink="true">http://www.pear-forum.org/viewtopic.php?p=2378#2378</guid>
                                      </item>
                                      <item>
                                        <title>Re: QuickForm - dynamic rules depending on checked radios</title>
                                        <link>http://www.pear-forum.org/viewtopic.php?p=2377#2377</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.pear-forum.org/profile.php?mode=viewprofile&amp;amp;u=918'&gt;mark&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Jul 09, 2007 10:19 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;aicos wrote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;I'm trying to figure out how to setup the rules for the following:&lt;br /&gt;
&lt;br /&gt;
Lets say I have 4 radios and a textbox. If one of the first 3 radios is filled in then the textbox requires no text. If the forth radio is filled in then the textbox requires some text. &lt;br /&gt;
&lt;br /&gt;
Putting all the elements inside a group and adding a required rule doesn't work (yes I was silly enough to try that).&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
Using a group is not wrong here. But you need to define your own (group) rule that checks this special case. You can define both a server- (needed) and a client-side rule. Examples for such custom roles should be availabe in the manual.</description>
                                        <comments>http://www.pear-forum.org/viewtopic.php?p=2377#2377</comments>
                                        <author>mark</author>
                                        <pubDate>Mon Jul 09, 2007 10:19 am</pubDate>
                                        <guid isPermaLink="true">http://www.pear-forum.org/viewtopic.php?p=2377#2377</guid>
                                      </item>
                                      <item>
                                        <title>QuickForm - dynamic rules depending on checked radios</title>
                                        <link>http://www.pear-forum.org/viewtopic.php?p=2375#2375</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.pear-forum.org/profile.php?mode=viewprofile&amp;amp;u=2802'&gt;aicos&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon Jul 09, 2007 2:10 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi. &lt;br /&gt;
&lt;br /&gt;
I'm trying to figure out how to setup the rules for the following:&lt;br /&gt;
&lt;br /&gt;
Lets say I have 4 radios and a textbox. If one of the first 3 radios is filled in then the textbox requires no text. If the forth radio is filled in then the textbox requires some text. &lt;br /&gt;
&lt;br /&gt;
Putting all the elements inside a group and adding a required rule doesn't work (yes I was silly enough to try that).&lt;br /&gt;
&lt;br /&gt;
Any suggestions?&lt;br /&gt;
&lt;br /&gt;
Thanks.</description>
                                        <comments>http://www.pear-forum.org/viewtopic.php?p=2375#2375</comments>
                                        <author>aicos</author>
                                        <pubDate>Mon Jul 09, 2007 2:10 am</pubDate>
                                        <guid isPermaLink="true">http://www.pear-forum.org/viewtopic.php?p=2375#2375</guid>
                                      </item></channel></rss>