Monday, June 29, 2009

Re: Issue in validation

Hello Bhushan,

Cake php uses that default layout file to show the common layout.And it takes the home.ctp in pages folder.

Are you using default.ctp for default layout?

If not please refer that file.
You can get that file in the project folder=>app=>views=>layouts=>default.ctp

In default.ctp  you will get a line of code that is,

<?php echo $session->flash();?>

This line produce the inbuilt errors that are from the validate.

So if you are not using that default.ctp file then use that line of code every where in the code at the top.

On Mon, Jun 29, 2009 at 6:00 PM, bhushan A <bhushanahirrao@gmail.com> wrote:

Hi  all,

 I am facing issue in displaying error message for validation.
I have added following code in model

var $validate = array(
                'product_name' => VALID_NOT_EMPTY
                );

and following code in view file i.e. add.thtml

<?php echo $form->input('product_name', array('size' => '15', 'name'
=> 'product_name', 'error' => false)); ?></td>
       <?php echo $form->error('<table_name>.product_name', 'Please enter
product name'); ?>


But it is not displaying error message. Can anybody help me? Do we
need to modify controller also for validation?




--
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: