Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Victor Pineda
Data too long when saving content from liferay-ui:input-editor
August 11, 2012 7:05 AM
Answer

Victor Pineda

Rank: New Member

Posts: 6

Join Date: February 8, 2012

Recent Posts

Hi all, I'm new in Liferay and I am trying to develop a new portlet, similar to blogs. I have a form with the liferay-ui:input-editor component to introduce long text with html format.
When I submit the form, I get an error if the text entered in the input-editor is a bit long:

[JDBCExceptionReporter:76] Data truncation: Data too long for column 'content' at row 1

I have defined in service.xml the column content as follow: <column name="content" type="String" />. I guess that the database cant store long text in this column, but I can see in service.xml from blogs portlet the same definition for the column content: <column name="content" type="String" />. So, I dont know how to store large text in the database without get the error "Data too long".

I'm using MySQL (UTF-8) and the type of the column "content" is longtext. I have also defined a hint <field name="content" type="String"><hint name="max-length">2000000</hint></field> in the file portlet-model-hints.xml but the problem is still there

Someone can help me? Thanks very much (And sorry for my bad english).
Hitoshi Ozawa
RE: Data too long when saving content from liferay-ui:input-editor
August 11, 2012 5:56 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Check the data type of the created table in the database.
Sagar A Vyas
RE: Data too long when saving content from liferay-ui:input-editor
August 12, 2012 1:04 AM
Answer

Sagar A Vyas

Rank: Liferay Master

Posts: 657

Join Date: April 17, 2009

Recent Posts

Hi,

You can check Change in size of columns.

Hope this help.

Thanks,
Sagar Vyas
Victor Pineda
RE: Data too long when saving content from liferay-ui:input-editor
August 12, 2012 2:47 AM
Answer

Victor Pineda

Rank: New Member

Posts: 6

Join Date: February 8, 2012

Recent Posts

The data type is 'longtext'. I have done a insert query directly to the database with a long text and I can store it without problems, so I dont know why liferay is not able to do it.
Hitoshi Ozawa
RE: Data too long when saving content from liferay-ui:input-editor
August 12, 2012 2:27 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

If the database table column size is correct, check if there is a maxsize specified in the input field in the html tag or the css class. To test, explicitly insert a maxsize attribute in the input field to see if the value goes through.

BTW, did you recreate the services after changing hints because it's working for me.
Victor Pineda
RE: Data too long when saving content from liferay-ui:input-editor
August 14, 2012 10:53 AM
Answer

Victor Pineda

Rank: New Member

Posts: 6

Join Date: February 8, 2012

Recent Posts

It seems to be solved after relaunch build-service, thanks you very much!
Hitoshi Ozawa
RE: Data too long when saving content from liferay-ui:input-editor
August 14, 2012 2:32 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Good to hear that you got it working. It's necessary to rebuild service (ant build-service) after making modification to scheme definition and interface definition.
Mathieu Hicauber
RE: Data too long when saving content from liferay-ui:input-editor
September 11, 2012 5:19 AM
Answer

Mathieu Hicauber

Rank: Junior Member

Posts: 79

Join Date: December 22, 2010

Recent Posts

Hitoshi Ozawa:
If the database table column size is correct, check if there is a maxsize specified in the input field in the html tag or the css class. To test, explicitly insert a maxsize attribute in the input field to see if the value goes through.

BTW, did you recreate the services after changing hints because it's working for me.


Hi,

Got the same problem here.
I made a custom model hints file, ext-model-hints.xml, and added it to an ext plugin.

I thought that would be enough, I don't get the build-services step : whar service.xml file are we talking about ?

Thank you very much.

Mathieu.