Re: why does the form error appear above and below the input field?

2008-02-06 Thread Siebren Bakker
@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.
>
> Add New Product
>
> tagErrorMsg('Product/code', $pcode_error) ?>
> tagErrorMsg('Product/product_name', 'Name
> required.') ?>
> tagErrorMsg('Product/price', 'Price  required in
> numeric.') ?>
>
>
>  method="post" enctype="multipart/form-data">
> 
> Code:
>inputTag('Product/code', array('size' =>
> '40')) ?>
>
> Name:
>inputTag('Product/product_name', array('size'
> => '40')) ?>
>
> Price:
>inputTag('Product/price', array('size' =>
> '40')) ?>
> submitTag('add') ?>
>
> 
> 
>
> 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 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
-~--~~~~--~~--~--~---



Re: why does the form error appear above and below the input field?

2008-02-05 Thread Rgarg

you can display error anywhere.
i am using following code for display errors at top of the form.

Add New Product

tagErrorMsg('Product/code', $pcode_error) ?>
tagErrorMsg('Product/product_name', 'Name
required.') ?>
tagErrorMsg('Product/price', 'Price  required in
numeric.') ?>




Code:
inputTag('Product/code', array('size' =>
'40')) ?>

Name:
inputTag('Product/product_name', array('size'
=> '40')) ?>

Price:
inputTag('Product/price', array('size' =>
'40')) ?>
submitTag('add') ?>




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
-~--~~~~--~~--~--~---



Re: why does the form error appear above and below the input field?

2008-02-05 Thread Amit Badkas
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
-~--~~~~--~~--~--~---



why does the form error appear above and below the input field?

2008-02-05 Thread johnnyice

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()??


Thanks in advance!

j


Code is below...


View

echo $form->error('username');
echo $form->input('username', array('size' => '15', 'label' =>
'Username'));


Model

var $validate = array(
'username' => array(
'rule' => 'alphaNumeric',
'message' => 'Only letters and numbers please'
)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---