Hi,

I have a working contact form on my project and I am about just to use
another form within another controller.
So I copied all from my contact model into my newsletter model:

<?php
class Newsletter extends AppModel {
        var $name = 'Newsletter';
    var $useTable = 'newsletter';

    function _validationRules() {
        $this->validate = array(
            'news_company' => array(
                'rule' => 'notEmpty',
                'message' => __('Bitte tragen Sie hier Ihren Namen
ein.', true)
            )
        );
    }

}
?>

My Controller:
<?php
class NewsletterController extends AppController {

        var $name = 'Newsletter';

function surveyfinal(){
        if ($this->RequestHandler->isPost()) {
            if ($this->Newsletter->validates()) {
                 echo "ok";
             }else{
                $this->Session->setFlash(__('Ihre Anfrage konnte nicht
versendet werden! Bitte prüfen Sie die markierten Felder.', true));
            }
        }
    }


The strange thing is, that this the same like my contact form, and
there the validation works!
But the data (is present, proofed) is not validating.

debug($this->Newsletter->validate);

is always empty!

if I use this instead:
var $validate = array(
        'news_company' => array(
            'required' => array('rule' => 'notEmpty', 'message' =>
'EmptyName')
        ),
the form is validating its data, but I need to have it multilingual,
like in my contact form.

Within my controller I can work with $this->Newsletter. Means I can
connect to my model. I have some other function where I read and save
data from/to my database.

I really don't understand, why just the validation data is not
present??

Anyone any ideas??

Thanks!!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to