I had validation all working fine with my table-less model in CakePHP
1.1 and then I moved to CakePHP 1.2 for the internationalization
functionality.  Now my validation is not working.  I figured out I
have ot change my $html->tagErrorMsg() to $form->error() but now my
error messages are not dispayed?

here is a portion of my view:

<form action="<?=$html->url('/user/register')?>" method="post"
accept-charset="utf-8" class="csForm">

<fieldset>
    <legend><?__("header_your_info")?></legend>
    <div>
        <label><?=REQUIRED?><?__("label_first_name")?></label>
        <?=$html->input('user.first_name', array('maxlength' => 50))?>
        <?=$form->error('user.first_name', 'First Name Required')?>
    </div>

here is a portion of my controller:

    function register() {
        Configure::load('config');
        $this->pageTitle = SITE_NAME . ' | Register';
        $this->set('page_header', 'Register');

        // view variables
        $this->set('countries',      Configure::read('countries'));
        $this->set('country',        $this->data['user']['country']);
        $this->set('province_error', '');
        $this->set('salutations',    Configure::read('salutations'));
        $this->set('states',         Configure::read('states'));

        if (!empty($this->data)) { // was anything submitted?

            // state or province?
            if (strcasecmp($this->data['user']['country'], 'USA') == 0) {
                if (strlen(trim($this->data['user']['state'])) == 0) {
                    $this->User->invalidate('state');
                    $this->set('province_error', 'State Required');
                }
            } else {
                if (strlen(trim($this->data['user']['province'])) == 0) {
                    $this->User->invalidate('province');
                    $this->set('province_error', 'Province Required');
                }
            }

            //if ($this->User->validates($this->data['user'])) {
            if ($this->User->validates()) {

...

            } else {
                $this->validateErrors($this->User);
            }

        } else {
            $this->render(); // form not submitted
        }
    }

-- 
Aaron Thies

"When you're married you'll understand the value of fresh produce."
- Tony Soprano

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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