On Fri, Jul 23, 2010 at 8:35 AM, Papa_Gateau <[email protected]> wrote:
> Hi I'm using cake 1.1 and am fairly new to it - I've inherited a
> fairly complex application which I have been tasked with updating.

First thing: consider upgrading the app immediately, rather than
adding even more functionality. You'll have to upgrade it eventually
anyway and the 1.1 branch lacks *a lot* of very cool stuff. Not to
mention security holes that may exist. Explain to your boss/client
that a little extra time spent now is worth it in the long run.

> My problem/situation is this:
>
> I have a registration form which takes input and updates a User
> table.  However, there are certain fields that need to be captured
> that don't update the underlying table/model.  These fields are
> captured purely to be sent to the site administrator via email.
>
> I have created a dummy controller with $useTable = false and a
> $validate array and I have referenced this model in the form inputs.

You meant a dummy model?

> so my markup looks something like
>
> $html->input('Userforename')

 $html->input('User/forename')


> $html->input('User/surname')
> -- additional User fields follow --
>
> then I have for the non User model fields
>
> $html->input('Formextra/misc1')
> $html->input('Formextra/misc2')
> $html->input('Formextra/misc3')
> $html->input('Formextra/misc4')
>
> In my user-controller I have added the following
>
> var $uses = array('Formextra','User');
>
> yet when I submit the form - the user validation is called and works
> but the non-User validation (Formextra) does not validate.
>
> Coudl anyone shed some light on this or is there better way to take
> form input that is not destined to update the underlying table.

I may be wrong about this (it's been a long time since I touched 1.1)
but you should be able to dispense with the FormExtra model altogether
and set up your form elements like so:

$html->input('misc1')
$html->input('misc2')
$html->input('misc3')
$html->input('misc4')

Cake will ignore these when you save the User model because it checks
the model schema first.

Debug the submitted data to see how it comes in to the controller.

if (!empty($this->data))
{
    die(debug($this->data));

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