Re: Error message for the extension validation rule will not display

2009-03-26 Thread hasentopf

Thanks Ryanam1,

I was looking for "echo $form->error('imagename'); " a long time

:-)

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



Re: Error message for the extension validation rule will not display

2009-03-08 Thread ryanam1

Thanks guys...

I didn't see that missing closing parentheses,

Unfortunately the error message still did not show but I figured it
out.

In my view I added the following line:
echo $form->error('imagename');



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



Re: Error message for the extension validation rule will not display

2009-03-05 Thread Son Dat Giang
var $validate = array(
   'imageupload' => array(
   'rule' => array('extension', array('gif', 'jpeg', 'png',
'jpg'),
   'message' => 'Please supply a valid image.'
   )
   )
   ,
'email'=>array(
'rule'=>'email',
'message'=>'Please enter a proper email'
   )
   );
should be like this

var $validate = array(
 'imageupload' => array(
'rule' => array('extension', array('gif',
'jpeg', 'png', 'jpg')),
'message' => 'Please supply a valid image.'
 ),
 'email'=>array(
'rule'=>'email',
 'message'=>'Please enter a proper email'
 )
);
-
Best regards !
Giang Son Dat
Mobile: +84 988114164
Email giangson...@gmail.com, giangson...@yahoo.com


On Thu, Mar 5, 2009 at 6:37 PM, Dr. Loboto  wrote:

>
> 'message' key-value should be in 'imageupload' array, not in 'rule'
> one. You messed braces.
>
> On Mar 5, 9:49 pm, ryanam1  wrote:
> > Hi,
> >
> > I am new to CakePHP and I am having trouble getting the extension
> > error message to display. The error message for the email rule
> > displays fine when someone enters an improperly formatted email and I
> > tried other examples of Cake's built in validation, they all seem to
> > work fine except for the extension validation.  Can someone please
> > tell me what I am doing wrong.
> >
> > Here are the validation rules in my model:
> >   var $validate = array(
> > 'imageupload' => array(
> > 'rule' => array('extension', array('gif', 'jpeg', 'png',
> > 'jpg'),
> > 'message' => 'Please supply a valid image.'
> > )
> > )
> > ,
> > 'email'=>array(
> > 'rule'=>'email',
> > 'message'=>'Please enter a proper email'
> > )
> > );
> >
> > Here is the snippet code in the Controller:
> >function add(){
> > if (!empty($this->data)) {
> >
> > if($this->Student->save($this->data)){
> >
> > $this->flash('Success','/add');
> > }
> > }
> > }
> >
> > Finally the snippet code in my view:
> >  > echo $form->create('Student',array('type' => 'file'));
> > echo $form->input('email');
> > echo $form->file('imageupload');
> > echo $form->end('Add');
> > ?>
> >
> > Again, the display message for the email displays correctly so I know
> > that the validation is working at least somewhat.  The validation for
> > the file upload seems to operate correctly. If I try to upload a file
> > with a .DOC extension the "save" fails except that it does not display
> > the error message at all.
> >
> > Please help what am I doing wrong?
> >
>

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



Re: Error message for the extension validation rule will not display

2009-03-05 Thread Dr. Loboto

'message' key-value should be in 'imageupload' array, not in 'rule'
one. You messed braces.

On Mar 5, 9:49 pm, ryanam1  wrote:
> Hi,
>
> I am new to CakePHP and I am having trouble getting the extension
> error message to display. The error message for the email rule
> displays fine when someone enters an improperly formatted email and I
> tried other examples of Cake's built in validation, they all seem to
> work fine except for the extension validation.  Can someone please
> tell me what I am doing wrong.
>
> Here are the validation rules in my model:
>   var $validate = array(
>     'imageupload' => array(
>         'rule' => array('extension', array('gif', 'jpeg', 'png',
> 'jpg'),
>         'message' => 'Please supply a valid image.'
>         )
>         )
>         ,
> 'email'=>array(
> 'rule'=>'email',
> 'message'=>'Please enter a proper email'
>         )
>     );
>
> Here is the snippet code in the Controller:
>    function add(){
>         if (!empty($this->data)) {
>
>             if($this->Student->save($this->data)){
>
>                 $this->flash('Success','/add');
>             }
>         }
>     }
>
> Finally the snippet code in my view:
>  echo $form->create('Student',array('type' => 'file'));
> echo $form->input('email');
> echo $form->file('imageupload');
> echo $form->end('Add');
> ?>
>
> Again, the display message for the email displays correctly so I know
> that the validation is working at least somewhat.  The validation for
> the file upload seems to operate correctly. If I try to upload a file
> with a .DOC extension the "save" fails except that it does not display
> the error message at all.
>
> Please help what am I doing wrong?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---