B Logica ot works!!
Thank you so much!! Now I can keep moving on this amazing framework!! Thanks
to all you guys for your answers!! Hope someday I can help you on something.
Just the last question about this problem. When I echo and input it renders
a label in the view with the field name right next to the input box. How can
I make that label not to appear cuz I want to make labels on my own. Thanks.
Anytime,
Matt.-
On Sun, Apr 20, 2008 at 12:30 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> function add()
> {
> if (!empty($this->data))
> {
> // debugging; make sure app/tmp is writeable by the webserver
> $this->log($this->data);
> // Remove that later, btw. Look in app/tmp/logs/error.log
>
> // add this
> $this->Master->create();
>
> if ($this->Master->save($this->data))
> {
> $this->flash('Your post has been saved.','/masters');
> }
> }
> }
>
>
> Make sure your view has the correct form opener:
>
> $form->create('Master', array('action' => 'add'))
>
> And leave out the 'name' on your form inputs. Let Cake handle that.
> You're free to set the ID how you want, in case of javascript
> interaction.
>
> If you're using Cake 1.2 use this syntax:
>
> $form->input('Master.name', array('type' => 'text', 'size' =>
> '30','class' => 'formfield'))
>
> Also, you're using echo for your inputs, so make sure to put a
> semi-colon at the end
>
> <?php echo $form->input(...); ?>
>
> If you use the short tag syntax you don't need it, though.
>
> <?= $form->input(...) ?>
>
> On Sun, Apr 20, 2008 at 2:52 AM, Matias Veleda <[EMAIL PROTECTED]>
> wrote:
> > Hey guys,
> >
> > Thanks for the answers. I think I'm doing things right, I mean, I
> followed
> > the "Post/Comments" example on the CakePHP Manual. In my case, I hace
> > Masters and MasterDetails. Just for you to have an idea:
> >
> > The function in the Controller looks like this:
> >
> > function add()
> > {
> > if (!empty($this->data))
> > {
> > if ($this->Master->save($this->data))
> > {
> > $this->flash('Your post has been saved.','/masters');
> > }
> > }
> > }
> >
> > And a part of the html that build the field looks like this:
> >
> > <tr>
> > <td colspan="2">
> > <?php echo $form->input('Master/name',
> > array('type' => 'text', 'size' => '30','class' => 'formfield', 'name' =>
> > 'name'))?>
> > <?php echo $form->error('Master/name',
> 'Name is
> > required.') ?>
> > </td>
> > </tr>
> >
> > The form is going to the right function cuz I placed and echo at the
> > beginning and it works, but still $data is always empty. Is this
> anything
> > wrong in the HTML?
> >
> > Thanks in advance!
> >
> > Matt.
> >
> >
> >
> >
> > On Sun, Apr 20, 2008 at 3:40 AM, Gonzalo Servat <[EMAIL PROTECTED]>
> wrote:
> > >
> > >
> > >
> > > On Sat, Apr 19, 2008 at 9:31 PM, Matias Veleda <[EMAIL PROTECTED]
> >
> > wrote:
> > >
> > >
> > >
> > >
> > >
> > > >
> > > > Hey guys,
> > > >
> > > > I'm new to CakePHP. I followed the instructions in the manual, the
> > > > example case and everytime I want to update my databaser from a form
> > > > my $data is always empty, what am I doing wrong? It's like nothing
> > > > happens when I press submit button.
> > > > Sorry my english, I'm from Argentina. Hope someone can help me soon
> > > > cuz I need to solve this urgently!
> > > >
> > >
> > >
> > > <ES>
> > > Hola Matias,
> > >
> > > Desde donde estas tratando de ver el contenido de $data ? En el
> controller
> > tendrias que fijate en $this->data, y si queres ver el contenido desde
> un
> > "Model" tendrias que pasar $this->data como argumento.
> > >
> > > Suerte!
> > > </ES>
> > >
> > > <EN>
> > > Hi Matias,
> > >
> > > Where are you trying to look at the content of $data from? If it's
> from a
> > controller you'd have to look into $this->data, and if you want to look
> at
> > the content from a Model you'd have to pass $this->data as an argument.
> > >
> > > Good luck!
> > > </EN>
> > >
> > > - Gonzalo
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > >
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---