Tuesday, January 5, 2010

RE: Error Placement / Styles

Thanks John,

Good looking out! I will add that since its more cake-ish than my current
setup with the after method.

Thanks again for your time and sorry for the confusion :)

Dave

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of John Andersen
Sent: January-05-10 2:45 PM
To: CakePHP
Subject: Re: Error Placement / Styles

Hi Dave,

I did understand that your hint was - a hint to the user - but I assumed
that you would find out how to include that together with the form field
definition :)

Using the form helper, I would just add the "after" option to include
something after the entry field. Using your hint code, I get the following
HTML code.

[code]
<div class="input text"><label for="ReporterEmail">E-mail</
label><input name="data[Reporter][email]" type="text" class="email"
maxlength="128" value="" id="ReporterEmail" /><p class="form_hint"><span
class="bold red">Required:</span>Password must be minimum of 8
characters.</p></div> [/code]

As you can see, your hint is placed after the input tag. This is all done,
just by using the form helper.

My form helper code for the above is then:

[code]
print( $form->input( 'Reporter.email', array('label' => __
('visitors_email',true), 'class' => 'email', 'error' => array
('report_email_rule' => __('report_email_rule',true) ), 'after' => '<p
class="form_hint"><span class="bold red">Required:</span>Password must be
minimum of 8 characters.</p>' ) ) ); [/code]

If you don't want the error message to show up, just define it as " "
- a blank ;)

Well, if you can use it, good, else good that your solution is working also!
Enjoy,
John

On Jan 5, 7:57 pm, "Dave" <make.cake.b...@gmail.com> wrote:
> Thanks,
>
> This works perfect.
> <li <?php if($form->error('User.password')){?> class='error''<?php }?>
> > </li>
>
> After re-reading Johns email I think i gave the impression that the
> hint was the error message. That is where I may have causeed some
> confusion. The hint is always visible, its not an error message.
> Imagine a field  called "User.specialty" and the hint was "Please
> describe briefly your background in this area". It only provides a hint to
the user as to what info to enter.
> Then if they skip that field I then display my error "Please enter
> your Specialty"....or what not
>
> Thanks guys,
>
> Dave
>
[snip]

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/05/10
04:05:00

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate