Matzn Posted March 15, 2022 Share Posted March 15, 2022 I want to save HTML Code in multilanguage field (productDescription -> texarea, unknow text) from module. But for the last language is nothing written in this field. It only works when I sanitized the string. foreach ($this->languages as $language) { $this->user->language = $language; //get spreadshit product data $this->productTypeData = $this->getProduct($language); $this->page->of(false); //fields by language $this->page->title = $this->productTypeData->name; $this->page->fit = $this->productTypeData->sizeFitHint; $this->page->shortDescription = $this->productTypeData->shortDescription; $this->page->productDescription = $this->productTypeData->description; //include html tags $this->page->save(); } Link to comment Share on other sites More sharing options...
Matzn Posted March 15, 2022 Author Share Posted March 15, 2022 I've tested alternate syntax with "setLanguageValue" . Get the same result. But to sanitized the input from field "productDescription" works: $this->page->productDescription = $this->sanitizer->textarea($this->productTypeData->description); Are there bad signs that cause this to skip? As I said, only at the last language (danish). If i change the language order, it's always the last language. Link to comment Share on other sites More sharing options...
bernhard Posted March 15, 2022 Share Posted March 15, 2022 May I ask why you want to save HTML code? The screenshot looks like it would be a perfect fit for a CKEditor field... Link to comment Share on other sites More sharing options...
Matzn Posted March 15, 2022 Author Share Posted March 15, 2022 Hi @bernhard. I've tested all field settings, but nothing works. I want html to save, because i think i can. ? Edit: But now i found something by save directly this field (i am surprised why get this exception not by saving the page - maybe it´s different by saving from template or module): $this->page->save("productDescription"); I get a SQL error by can't save this table: it was too big or similar message (can't remember on the exact message). This means, the data to save is too big for this table ( field_productDescription). So i've set the table to ROW_FORMAT=DYNAMIC. This is a general problem and know it from other multilanguage sites - but forget. ? Link to comment Share on other sites More sharing options...
Matzn Posted March 21, 2022 Author Share Posted March 21, 2022 The error message as mentioned above: Quote Error: Exception: SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. (in wire/core/Fieldtype.php line 1333) Now change the affected field to ROW_FORMAT=DYNAMIC like: ALTER TABLE `mytable` ROW_FORMAT=DYNAMIC; In my case for field productDescription: ALTER TABLE `field_productDescription` ROW_FORMAT=DYNAMIC; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now