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):
---------------------------------------------------------------------------------------
<?php echo $form->create(NULL,
array(
'default' => true,
'inputDefaults' => array(
'label' => false,
'div' => false
)
)
); // default => onsubmit true/false ?>
<?php echo $form->input('username', array('size'=> 20, 'maxlength'
=> 50)); ?>
<?php echo $form->input('pw', array('type' => 'password',
'size'=> 20, 'maxlength' => 50)); ?>
<?php echo $form->submit('Log In »', array('class' =>
'submit', 'name' => 'submit', 'title' => 'Enter your username and
password for access.', 'class' => 'button', 'escape' => false)); ?>
<?php echo $form->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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment