Hello John, Only because I have my hint class <p> in there so in my forms there is a little text beside each field. This is all wrapped inside the <li> Sure I can get the input text error to get an error class to hi-light the text field, but looks rather dumb when the form has : Form
<li class = "error"> [label] [field] [hint] </li> <li class = "error"> [label] [field] [hint] </li> <li class = "error"> [label] [field] [hint] </li> <li class = "error"> [label] [field] [hint] </li> Its not so much the error message I care about, I am not trying to place that anywhere, just the error class. I need to add it to the entire <li></li> that houses my field, lable, and what not. So everything inside then has my red bg error class, not just the field and lable. -----Original Message----- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of John Andersen Sent: January-05-10 5:16 AM To: CakePHP Subject: Re: Error Placement / Styles Well, now that I took a better look at your code, I don't understand why you don't use the standard cake form field and error generation, because that should be all you need :) Example HTML from my own code where the field has an error - it is mandatory: [code] print( $form->input( 'Reporter.email', array('label' => __ ('visitors_email',true), 'class' => 'email', 'error' => array ('report_email_rule' => __('report_email_rule',true) ) ) ) ); [/code] produces the following HTML when I don't enter an e-mail address! [code] <div class="input text error"> <label for="ReporterEmail">E-mail</label> <input name="data[Reporter][email]" type="text" class="email form- error" maxlength="128" value="" id="ReporterEmail" /> <div class="error-message" report_email_rule="report_email_rule">reporter_email_rule</div> </div> [/code] Observe that the form helper has automatically inserted the error class in the div element! Enjoy, John On Jan 5, 10:15 am, "Dave" <make.cake.b...@gmail.com> wrote: > Thanks John, > > I did set the 'error' => false so no message shows. But how do I get > the error class to end up inside the <li> > > I tried an assortment of attemps with > > <li class="<?php echo $form->error('User.password', NULL, array()); ?>"> ??? > But nothing. > > Ideas? > > Thanks, > > Dave > > -----Original Message----- > From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On > Behalf > > Of John Andersen > Sent: January-05-10 4:35 AM > To: CakePHP > Subject: Re: Error Placement / Styles > > Yes you can! > In the form field, add the option 'error' => false to disable the > automatic error message. Then use the form helpers error method for > the field and place it whereever you want. > Seehttp://book.cakephp.org/view/721/error > Enjoy, > John > > On Jan 5, 9:46 am, "Dave" <make.cake.b...@gmail.com> wrote: > > Is it possible to determine where the error class gets added? > > > for example: > > > <fieldset> > > <ul> > > <li><?php echo $form->input('User.password', array('label' => > > 'Password:')); ?> > > <p class="form_hint"><span class="bold > > red">Required:</span> Password must be minimum of 8 > > characters.</p></li> > > <li><?php echo $form->input('User.username', array('label' => > > 'Select a Username:')); ?> > > <p class="form_hint"><span class="bold > > red">Required:</span> Username can never be changed.</p></li> > > > </ul> > > </fieldset> > > > So if a field fails i would like to add the error class to the <li> > > so the entire row gets the error class like <li class="error"> > > > Thanks > > > Dave > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help > others with their CakePHP related questions. > > You received this message because you are subscribed to the Google > Groups "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com To > unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this > cake-php+group athttp://groups.google.com/group/cake-php?hl=en > No virus found in this incoming message. > Checked by AVG -www.avg.com > Version: 9.0.725 / Virus Database: 270.14.124/2599 - Release Date: > 01/04/10 04:54:00 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group cake-php+at http://groups.google.com/group/cake-php?hl=en No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.725 / Virus Database: 270.14.124/2599 - Release Date: 01/04/10 04:54:00
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en