Hi,

Sorry, but it didn't work.

This is what i did (following your example):
 <?php echo $form->create('User', array('url' => array('action' => 
'changePassword', $form->value('User.id')))); ?>

And this was the generated html:
 <form id="UserEditForm" method="post" 
action="/users/changePassword/3/3"><fieldset style="display:none;"><input 
type="hidden" name="_method" value="PUT" />


Actually I had already tried something similar (hardcoding the parameter) and 
had seen that generated <form> tag (functionName/id/id).

The Form Helper is actually creating the <form> tag correctly. The problem is 
when submitting the generated form.

If I simply code echo $form->create('User', array('action' => 
'changePassword')); the Form Helper correctly generates the <form> tag (adding 
the parameter at the end).

The problem is when submitting the generated form.




Dardo Sordi Bogado wrote:
> Try
> 
>  <?php echo $form->create('User', array('url' => array('action'  =>
> 'changePassword', 3))); ?>
> 
> I'm sure you'll be able to make it works for others ids than 3 ;)
> 
> HTH,
> - Dardo Sordi.
> 
> On Tue, Oct 28, 2008 at 12:30 AM, R. Davila <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> 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.
>>
>>
> 
> > 
> 
> ------------------------------------------------------------------------
> 
> 
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.175 / Virus Database: 270.8.4/1752 - Release Date: 10/28/2008 
> 10:04 AM
> 

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to