Copied to clipboard

Flag this post as spam?

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


  • brightspk 3 posts 73 karma points
    Jul 27, 2018 @ 08:53
    brightspk
    0

    Hi

    We have developed a site with a form. The form has a text area

    We want to set the maxlength attribute of the text area

    So we've amended FieldType.Textarea.cshtml, in /Views/Partials/Forms/Fieldtypes/FieldType.Textarea.cshtml

    adding that attribute but the attribute doesn't appear in the rendered markup

    We've stopped the site and restarted it We've republish everything, regenerating the xml

    are we doing something wrong ?

    @model Umbraco.Forms.Mvc.Models.FieldViewModel
    <textarea name="@Model.Name" id="@Model.Id" rows="2" cols="20" maxlength="500"
    @{if(string.IsNullOrEmpty(Model.PlaceholderText) == false){<text>placeholder="@Model.PlaceholderText"</text>}}
    @{if(Model.Mandatory || Model.Validate){<text>data-val="true"</text>}}
    @{if (Model.Mandatory) {<text> data-val-required="@Model.RequiredErrorMessage"</text>}}
    @{if (Model.Validate) {<text> data-val-regex="@Model.InvalidErrorMessage" data-regex="@Html.Raw(Model.Regex)"</text>}}
    >@Model.ValueAsHtmlString</textarea>
    

    Regards

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jul 27, 2018 @ 09:56
    Dan Diplo
    1

    Are you, perhaps, using a theme instead of the default fields?

    In \Views\Partials\Forms\ do you have a \Themes\ folder?

    If you do look in there and you should see a theme folder (eg. Boostrap) and within that there is another FieldTypes folder that contains the field types for the theme. Try altering those instead.

  • brightspk 3 posts 73 karma points
    Jul 27, 2018 @ 10:03
    brightspk
    0

    Hi Dan,

    Thanks for your response, the form is using the bootstrap theme within which we found another textarea.cshtml file.

    We've amended that, refreshed and your correct - its now being picked up

    Many thanks

Please Sign in or register to post replies

Write your reply to:

Draft