I have a textarea on one of my document-types. If I write approx. 300 characters in this field on a MVC-form on my website - I get an error telling me that it will be truncated. If I paste the same text into the field from Umbraco-backend it will store the data correctly.
In the model I have declared the field like this:
[Required]
public string Comment { get; set; }
In the cshtml-file I am referencing the field like this:
And in the controller I have this public function:
public ActionResult HandleFormSubmit(AthletePostCommentFormViewModel model)
{
//
if (!ModelState.IsValid)
return CurrentUmbracoPage();
//Create content
var newRecord = Services.ContentService.CreateContent(model.Comment, CurrentPage.Id, "federationCommentNode");
newRecord.SetValue("comment", model.Comment);
newRecord.SetValue("createdBy", Membership.GetUser().UserName);
Services.ContentService.SaveAndPublishWithStatus(newRecord);
TempData["success"] = true;
return RedirectToCurrentUmbracoPage();
}
I have googled for solutions and found one where the datatype was wrong in the SQL-database and table CMSDataType, but my field is a Ntext as described in those solutions.
My Umbraco version is 7.14.0 - anybody have any ideas as to what I am doing wrong? It might be something simple, as my skills as a programmer is very low :-)
Textarea gets truncated on website
Hi gurus,
I have a textarea on one of my document-types. If I write approx. 300 characters in this field on a MVC-form on my website - I get an error telling me that it will be truncated. If I paste the same text into the field from Umbraco-backend it will store the data correctly.
In the model I have declared the field like this:
In the cshtml-file I am referencing the field like this:
And in the controller I have this public function:
I have googled for solutions and found one where the datatype was wrong in the SQL-database and table CMSDataType, but my field is a Ntext as described in those solutions.
My Umbraco version is 7.14.0 - anybody have any ideas as to what I am doing wrong? It might be something simple, as my skills as a programmer is very low :-)
Hi Jimmy,
While submitting the form, are you using HTTP Get protocol as it only has restriction to truncate data.
Otherwise, while saving if data type is textarea then it accepts large value.
Can you do one thing to isolate the problem, i.e. replace
Instead of using model.Comment you type in large hard-coded text and try to save it and see if you still find the issue?
Regards,
Shaishav
It wasn't the comment-field that got truncated :-) It was the "name" of the created node:
But thanks for helping me on the right path :-)
is working on a reply...