Re: $_POST is populated with the form data, but $this->data is always empty

2010-12-01 Thread John Andersen
Please change your code part from:

   } else { pr('this->data not set!'); }

to

   } else {
  pr('this->data not set!');
  pr($this->data);
  }

So that we may be sure that $this->data is not set with anything
Enjoy,
   John

On 29 Nov., 22:18, amfriedman  wrote:
> Irrelevant for two reasons:
>
> - I wrote that I already tried with the form model set to 'User'
> - Manual says it is fine to do this (see the first yellow 
> box):http://book.cakephp.org/view/1384/Creating-Forms
>
[snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: $_POST is populated with the form data, but $this->data is always empty

2010-12-01 Thread Raisen
Did you try to check for the value of the data attribute from a method
invoked after the beforeFilter method? I would guess that the data
attribute is not set when beforeFilter is being called. Also, are you
calling the parent method on your method before reading the data?

parent::beforeFilter();

On Nov 29, 10:56 am, amfriedman  wrote:
> Hey folks
>
> This is a very strange issue indeed, and at its root it is NOT related
> to this post that declares a similar 
> symptom:http://groups.google.com/group/cake-php/browse_thread/thread/840eaa08...
>
> I have a form in /users/view/.  When I submit it and check $_POST and
> $this->data at the very beginning of AppController->beforeFilter(),
> the form data appears in the $_POST array but $this->data does not
> have any data.  In fact, $this->data is not even set by Cake!
>
> The Auth component is removed from the $components list, so I know
> that Auth is not the culprit.  I've also tried to test this form in
> different controllers/views, and I get the same problem.  Pretty
> scary, huh?
>
> --- 
> 
> Here is the view code (I've also tried setting the form->create()
> first argument with a model of 'User' and used full Model.field dot
> notation for my inputs):
> --- 
> 
>
>     create(NULL,
>                         array(
>                                   'default' => true,
>                                   'inputDefaults' => array(
>                                         'label' => false,
>                                         'div' => false
>                                   )
>                         )
>
>                   ); // default => onsubmit true/false  ?>
>
>                          input('username', array('size'=> 
> 20, 'maxlength'
> => 50)); ?>
>
>                          input('pw', array('type' => 
> 'password',
> 'size'=> 20, 'maxlength' => 50)); ?>
>
>                         submit('Log In »', 
> array('class' =>
> 'submit', 'name' => 'submit',  'title' => 'Enter your username and
> password for access.', 'class' => 'button', 'escape' => false)); ?>
>
>         end(); ?>
>
> --- 
> 
> Here is the app_controller:
> --- 
> 
>         function beforeFilter() {
>
>                 pr(__CLASS__.'::'.__FUNCTION__.'()...');
>
>                 pr('POST data: ');
>                 pr($_POST);
>
>                 if(isset($this->data)) {
>                         pr('this->data: ');
>                         pr($this->data);
>                 } else { pr('this->data not set!'); }
>        // ...
>    }
>
> --- 
> 
> Here is the browser output:
> --- 
> 
>    AppController::beforeFilter()...
>
> POST data:
>
> Array
> (
>     [_method] => POST
>     [data] => Array
>         (
>             [User] => Array
>                 (
>                     [username] => testuser
>                     [pw] => 12345
>                 )
>
>         )
>
>     [submit] => Log In »
> )
>
> this->data not set!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: $_POST is populated with the form data, but $this->data is always empty

2010-11-29 Thread amfriedman
Irrelevant for two reasons:

- I wrote that I already tried with the form model set to 'User'
- Manual says it is fine to do this (see the first yellow box):
http://book.cakephp.org/view/1384/Creating-Forms


On Nov 29, 4:04 pm, nurvzy  wrote:
> Why are you setting NULL as your form model?
>
> Try:
> create('User',
>                         array(
>                                   'default' => true,
>                                   'inputDefaults' => array(
>                                         'label' => false,
>                                         'div' => false
>                                   )
>                         )
>                   );
>
> Try looking in params.  I'm guessing it's being passed in as
> params['form'].
>
> HTH,
> Nick
>
> On Nov 29, 11:56 am, amfriedman  wrote:
>
>
>
>
>
>
>
> > Hey folks
>
> > This is a very strange issue indeed, and at its root it is NOT related
> > to this post that declares a similar 
> > symptom:http://groups.google.com/group/cake-php/browse_thread/thread/840eaa08...
>
> > I have a form in /users/view/.  When I submit it and check $_POST and
> > $this->data at the very beginning of AppController->beforeFilter(),
> > the form data appears in the $_POST array but $this->data does not
> > have any data.  In fact, $this->data is not even set by Cake!
>
> > The Auth component is removed from the $components list, so I know
> > that Auth is not the culprit.  I've also tried to test this form in
> > different controllers/views, and I get the same problem.  Pretty
> > scary, huh?
>
> > --- 
> > 
> > Here is the view code (I've also tried setting the form->create()
> > first argument with a model of 'User' and used full Model.field dot
> > notation for my inputs):
> > --- 
> > 
>
> >     create(NULL,
> >                         array(
> >                                   'default' => true,
> >                                   'inputDefaults' => array(
> >                                         'label' => false,
> >                                         'div' => false
> >                                   )
> >                         )
>
> >                   ); // default => onsubmit true/false  ?>
>
> >                          input('username', array('size'=> 
> > 20, 'maxlength'
> > => 50)); ?>
>
> >                          input('pw', array('type' => 
> > 'password',
> > 'size'=> 20, 'maxlength' => 50)); ?>
>
> >                         submit('Log In »', 
> > array('class' =>
> > 'submit', 'name' => 'submit',  'title' => 'Enter your username and
> > password for access.', 'class' => 'button', 'escape' => false)); ?>
>
> >         end(); ?>
>
> > --- 
> > 
> > Here is the app_controller:
> > --- 
> > 
> >         function beforeFilter() {
>
> >                 pr(__CLASS__.'::'.__FUNCTION__.'()...');
>
> >                 pr('POST data: ');
> >                 pr($_POST);
>
> >                 if(isset($this->data)) {
> >                         pr('this->data: ');
> >                         pr($this->data);
> >                 } else { pr('this->data not set!'); }
> >        // ...
> >    }
>
> > --- 
> > 
> > Here is the browser output:
> > --- 
> > 
> >    AppController::beforeFilter()...
>
> > POST data:
>
> > Array
> > (
> >     [_method] => POST
> >     [data] => Array
> >         (
> >             [User] => Array
> >                 (
> >                     [username] => testuser
> >                     [pw] => 12345
> >                 )
>
> >         )
>
> >     [submit] => Log In »
> > )
>
> > this->data not set!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: $_POST is populated with the form data, but $this->data is always empty

2010-11-29 Thread nurvzy
Why are you setting NULL as your form model?

Try:
create('User',
array(
  'default' => true,
  'inputDefaults' => array(
'label' => false,
'div' => false
  )
)
  );

Try looking in params.  I'm guessing it's being passed in as
params['form'].

HTH,
Nick

On Nov 29, 11:56 am, amfriedman  wrote:
> Hey folks
>
> This is a very strange issue indeed, and at its root it is NOT related
> to this post that declares a similar 
> symptom:http://groups.google.com/group/cake-php/browse_thread/thread/840eaa08...
>
> I have a form in /users/view/.  When I submit it and check $_POST and
> $this->data at the very beginning of AppController->beforeFilter(),
> the form data appears in the $_POST array but $this->data does not
> have any data.  In fact, $this->data is not even set by Cake!
>
> The Auth component is removed from the $components list, so I know
> that Auth is not the culprit.  I've also tried to test this form in
> different controllers/views, and I get the same problem.  Pretty
> scary, huh?
>
> --- 
> 
> Here is the view code (I've also tried setting the form->create()
> first argument with a model of 'User' and used full Model.field dot
> notation for my inputs):
> --- 
> 
>
>     create(NULL,
>                         array(
>                                   'default' => true,
>                                   'inputDefaults' => array(
>                                         'label' => false,
>                                         'div' => false
>                                   )
>                         )
>
>                   ); // default => onsubmit true/false  ?>
>
>                          input('username', array('size'=> 
> 20, 'maxlength'
> => 50)); ?>
>
>                          input('pw', array('type' => 
> 'password',
> 'size'=> 20, 'maxlength' => 50)); ?>
>
>                         submit('Log In »', 
> array('class' =>
> 'submit', 'name' => 'submit',  'title' => 'Enter your username and
> password for access.', 'class' => 'button', 'escape' => false)); ?>
>
>         end(); ?>
>
> --- 
> 
> Here is the app_controller:
> --- 
> 
>         function beforeFilter() {
>
>                 pr(__CLASS__.'::'.__FUNCTION__.'()...');
>
>                 pr('POST data: ');
>                 pr($_POST);
>
>                 if(isset($this->data)) {
>                         pr('this->data: ');
>                         pr($this->data);
>                 } else { pr('this->data not set!'); }
>        // ...
>    }
>
> --- 
> 
> Here is the browser output:
> --- 
> 
>    AppController::beforeFilter()...
>
> POST data:
>
> Array
> (
>     [_method] => POST
>     [data] => Array
>         (
>             [User] => Array
>                 (
>                     [username] => testuser
>                     [pw] => 12345
>                 )
>
>         )
>
>     [submit] => Log In »
> )
>
> this->data not set!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


$_POST is populated with the form data, but $this->data is always empty

2010-11-29 Thread amfriedman
Hey folks

This is a very strange issue indeed, and at its root it is NOT related
to this post that declares a similar symptom:
http://groups.google.com/group/cake-php/browse_thread/thread/840eaa08732904a1/6b214b69ad0980d4?lnk=gst&q=$_POST#6b214b69ad0980d4

I have a form in /users/view/.  When I submit it and check $_POST and
$this->data at the very beginning of AppController->beforeFilter(),
the form data appears in the $_POST array but $this->data does not
have any data.  In fact, $this->data is not even set by Cake!

The Auth component is removed from the $components list, so I know
that Auth is not the culprit.  I've also tried to test this form in
different controllers/views, and I get the same problem.  Pretty
scary, huh?

---
Here is the view code (I've also tried setting the form->create()
first argument with a model of 'User' and used full Model.field dot
notation for my inputs):
---

create(NULL,
array(
  'default' => true,
  'inputDefaults' => array(
'label' => false,
'div' => false
  )
)

  ); // default => onsubmit true/false  ?>


 input('username', array('size'=> 20, 
'maxlength'
=> 50)); ?>

 input('pw', array('type' => 
'password',
'size'=> 20, 'maxlength' => 50)); ?>

submit('Log In »', 
array('class' =>
'submit', 'name' => 'submit',  'title' => 'Enter your username and
password for access.', 'class' => 'button', 'escape' => false)); ?>

end(); ?>

---
Here is the app_controller:
---
function beforeFilter() {

pr(__CLASS__.'::'.__FUNCTION__.'()...');

pr('POST data: ');
pr($_POST);

if(isset($this->data)) {
pr('this->data: ');
pr($this->data);
} else { pr('this->data not set!'); }
   // ...
   }

---
Here is the browser output:
---
   AppController::beforeFilter()...

POST data:

Array
(
[_method] => POST
[data] => Array
(
[User] => Array
(
[username] => testuser
[pw] => 12345
)

)

[submit] => Log In »
)

this->data not set!


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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