you can display error anywhere. i am using following code for display errors at top of the form.
<h2>Add New Product</h2> <?php echo $html->tagErrorMsg('Product/code', $pcode_error) ?> <?php echo $html->tagErrorMsg('Product/product_name', 'Name required.') ?> <?php echo $html->tagErrorMsg('Product/price', 'Price required in numeric.') ?> <form action="<?php echo $html->url('/products/add'); ?>" method="post" enctype="multipart/form-data"> <table width="50%"> <tr><td><label>Code:</label></td> <td><?php echo $html->inputTag('Product/code', array('size' => '40')) ?></td></tr> <tr><td><label>Name:</label></td> <td><?php echo $html->inputTag('Product/product_name', array('size' => '40')) ?></td></tr> <tr><td><label>Price:</label></td> <td><?php echo $html->inputTag('Product/price', array('size' => '40')) ?></td></tr> <tr><td colspan='2'><?php echo $html->submitTag('add') ?></td></tr> </table> </form> On Feb 6, 10:13 am, "Amit Badkas" <[EMAIL PROTECTED]> wrote: > On Feb 6, 2008 8:51 AM, johnnyice <[EMAIL PROTECTED]> wrote: > > > > > So as most of you know the HtmlHelper::tagErrorMsg method has been > > deprecated and the new method to use is FormHelper::error. > > > I want the error message to appear ABOVE the input field, but it > > appears below by default. I then put in the extra form->error() call > > and now I get the message above AND below the field. > > > How can I force the error message to appear ABOVE the input field? > > Anything to do with the before, after options you send as arguments to > > input()?? > > - Yes. You have to set 'error' => false in input() method's second argument > array > > Code is below... > > > > > ------------ > > View > > ------------ > > echo $form->error('username'); > > echo $form->input('username', array('size' => '15', 'label' => > > 'Username')); > > - Above should be changed to $form->input('username), array('size' => 15, > 'label' => 'Username', 'error' => false)); > > -- > Regards, > Amit > > http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---