Thursday, July 4, 2013

Re: Translate Behavior Save and Validate more languages

Hi manzapanza,

Did you solve this issue?I have the same problem and is driving me crazy!

Thanks in advance


El martes, 8 de mayo de 2012 14:20:37 UTC+2, manzapanza escribió:
Some suggestions?
Thanks!

Il giorno lunedì 7 maggio 2012 10:33:41 UTC-3, manzapanza ha scritto:
I'm trying to Save and Validate categories with 3 translations for the field 'name' using TranslateBehavior.
I have a problem with the validation of the field with Translation.

Model/Category.php

public $actsAs = array('Translate' => array('name' => 'MyTranslateName'));
public $validate = array(
    'name' => array(
        'notempty' => array(
            'rule' => array('notempty'),
            'message' => 'Error notempty',
        ),
    ),
    .......
);

View/Categories/admin_edit.ctp:

    echo $this->Form->create('Category');
    echo $this->Form->input('Category.name.deu', array('label' => __d('Category', 'Name Deu')));
    echo $this->Form->input('Category.name.eng', array('label' => __d('Category', 'Name Eng')));
    echo $this->Form->input('Category.name.ita', array('label' => __d('Category', 'Name Ita')));
    echo $this->Form->end(__d('app', 'Submit'));

In the controller I use simply the save() method and the behavior store 3 records correctly in i18n table but the all three values are not validated.
Is validated only the field of language = $this->Category->locale but in case of a error the error is returned for Category.name field and not for Category.name.eng and for this error messages are not displayed...

How can I do to validate translations in the same form?

Thanks!
Massimo

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: