Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Jimmy Dan Mortensen 77 posts 197 karma points
    Aug 27, 2019 @ 12:57
    Jimmy Dan Mortensen

    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:

        public string Comment { get; set; }

    In the cshtml-file I am referencing the field like this:

     @Html.TextAreaFor(m => m.Comment, new { @class = "form-control", placeholder = "Kommentar" })

    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);
            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 :-)

  • Shaishav Karnani from 330 posts 1562 karma points
    Aug 27, 2019 @ 23:37
    Shaishav Karnani from

    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

    newRecord.SetValue("comment", model.Comment);

    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?



  • Jimmy Dan Mortensen 77 posts 197 karma points
    Aug 28, 2019 @ 07:46
    Jimmy Dan Mortensen

    It wasn't the comment-field that got truncated :-) It was the "name" of the created node:

    var newRecord = Services.ContentService.CreateContent(model.Comment, CurrentPage.Id, "federationCommentNode");

    But thanks for helping me on the right path :-)

Please Sign in or register to post replies

Write your reply to: