Ajax is definitely a working solution, but I'm somewhat leary of
requiring users to have javascript enabled (call me a purist :P)

An element is definitely a good idea. I'm still wondering if it would
be possible to pass data as part of a redirect. I've thought of
writing a function to create this functionality, but I'm not sure if
it would break the MVC paradigm. Definitely a function I would be
interested in knowing about, or seeing in future versions of CakePHP.

Thanks for the suggestion, John.

On Mar 16, 4:21 pm, John Andersen <j.andersen...@gmail.com> wrote:
> I would consider the use of an element to hold the contact form. Then
> have the contact form presented in both views!
> Seehttp://book.cakephp.org/view/97/Elementsfor the story on
> elements :)
>
> Later you may consider using an AJAX solution.
> Enjoy,
>    John
>
> On Mar 16, 9:48 pm, Johnny Ferguson <hyperfle...@gmail.com> wrote:
>
>
>
> > 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to