Yes , it looks better.
Thanx 2dee for clearance

On Jan 23, 11:52 am, 2dee <[EMAIL PROTECTED]> wrote:
> On Jan 23, 1:33 am, manish <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have a way of doing it, while I am not sure how good it is in
> > CakePHP terms, but it should work.
>
> > Set a variable (Suppose $test) for default value i.e. 'Beavis' in your
> > controller. But this should be set only in case when no data is posted
> > which means the page loads for the first time.
>
> > In your view file check:
> > if($test)
> > //Show your above written code with the test variable
> > $form->input('User.name', array('type'=>'text', 'value'=>$test));
> > else
> > //Show input type with no value, which should pick user entered value
> > the Cake way when the form is posted
> > $form->input('User.name', array('type'=>'text'));
>
> > Hope this works for you :)
>
> I think a more "cakeish" way would be to do this:
>
> if (!empty($this->data)) {
> ///////}
>
> else {
>         $this->data['model_name']['field_name'] = 'Default Value';
>
> }
>
> to your controller.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to