-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multilingual attributes empty when saving post on create #54
Comments
Try to add to your Post model rule [['title', 'content'], 'string'] |
Fine! It works now. |
The creation works. Thank to you snapget. But now I am facing a new save issue.
The view 'view' is correctly loaded with the data. Fine. Then I use this in the controller for update action
This time again data from the DB are correctly loaded into the form, but when submitting, it seems that the saving doesn't occur anew.
|
Try in actionUpdate
and in form view
in this way you can set values for both languages |
Thank you very much. It works! I put all the input fields into a _form.php that is common to both create and update. That way I can create and update every/any thing. But it can become cumbersome if there are multiple huge textareas and more languages, thus I must organise the fields in a tabbed view. |
The same question: why it's not possible to get and update record using "localized()" ? |
I am using "omgdef/yii2-multilingual-behavior": "^2.1" (the last version I guess)
My behavior in my Post class is as follow:
I added two fields for title and content in the _form()
Putting some spying instructions in saveTranslations() in the behavior, I can see that the $owner->$attribute values are always null for multilingal attributes.
The post table is correctly added a record but not the postlang table.
If I enter manually a record in postlang with the foreignkey pointing to a valide id in post table, when I call post/update/id the form is fully loaded (with title and content) from the DB. But after modifying the title and content (multilingual fields) and submitting, the updating doesn't happen.
Here is the create action
The text was updated successfully, but these errors were encountered: