@Rgarg - The $html->tagErrorMsg and $html->inputTag are all deprecated in
CakePHP 1.2, all forms are now done through the $form helper, not the $html
helper. Your code would work fine in a Cake 1.1xx app, but not in a Cake
1.2xx app anymore.
On Feb 6, 2008 1:19 AM, Rgarg <[EMAIL PROTECTED]> wrote:
>
> 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
> >
>
--
In the name of Life, Liberty, and the pursuit of my sanity.
Siebren Bakker(Aevum Decessus)
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d- s+: a19 C++++ UL++ P L++
!E W++ N(-) o? K? w(+) O? M-- V?
PS+ PE Y- PGP- t+ 5? X- R tv--
b++ Di D+ G+ e h! r y-
------END GEEK CODE BLOCK------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---