I have a controller function, and the corresponding view, setup like this:
function changePassword($id = null)
change_password.ctp
<?php echo $form->create('User', array('action' => 'changePassword')); ?>
<?php echo $form->hidden('password'); ?>
.
. Here I add the fields for old password, new password and retype new password
.
<?php echo $form->end('Submit'); ?>
The following is the generated html (the parameter to the changePassword function is the user id, in this case 3):
<form id="UserChangePasswordForm" method="post" action="/users/changePassword/3">
<fieldset style="display:none;"><input type="hidden" name="_method" value="POST" /></fieldset>
<input type="hidden" name="data[User][password]" value="encrypted password value" id="UserPassword" />
So far so good.
The problem is that when I fill the form fields and click the Submit button,
the data is being posted to "/users/changePassword" instead of "/users/changePassword/3"
I'm writing $this->params to the FirePHP console at the top of the changePassword function and this is what I get:
When I access the page initially:
Array
(
[pass] => Array
(
[0] => 3
)
[named] => Array
(
)
[controller] => users
[action] => changePassword
[plugin] =>
[form] => Array
(
)
[url] => Array
(
[url] => users/changePassword/3
)
)
After I click on Submit:
Array
(
[pass] => Array
(
)
[named] => Array
(
)
[controller] => users
[action] => changePassword
[plugin] =>
[form] => Array
(
)
[url] => Array
(
[url] => users/changePassword
)
)
As you can see the "user id" parameter is lost.
Any ideas?
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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