Hi,

I've poured over all the documentation I possibly can, and searched
the newsgroups, and haven't yet found a solution to my problem.

I'm creating a contact form which doesn't use any databases. As the
controller action never calls save(), I don't get any of the nice
automatic validation.

Here are my files:

Contact Model: http://bin.cakephp.org/view/568757600
Contacts Controller: http://bin.cakephp.org/view/1939947381
/views/contact/index.ctp (main form):http://bin.cakephp.org/view/
526960429
/views/contact/add.ctp:http://bin.cakephp.org/view/378503276

The add() method of my ContactsController will take the data from the
form at index.ctp, and if it all validates, send off an e-mail. The
else clause near the bottom of the add() method attempts to send the
user back to the original form if they made any errors, passing the
array of errors so that they can be displayed near the form fields.

It doesn't look as though $this->redirect() can pass data to a view,
so I'm wondering how I can achieve this. It just seems inefficient to
reproduce the form on the add.ctp view. If this is the only option,
I'll have to go ahead with it, but if anyone can offer a more elegant
solution, I'd be interested to hear of it.

Thanks for having a look. If I get this figured out, I'll be sure to
write an article on my blog so that complete newbies like myself can
figure this out. To me a contact form with validation is extremely
basic, and I didn't figure it would be so hard to get this going. I
have found articles on how to do this, and although the Contact model
has a validation array, the errors aren't automagically popping up on
the form, so I need to do it manually somehow.

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