@using OrchardCore.Forms.Models
@model ShapeViewModel<TextAreaPart>
@{
    var formElementPart = Model.Value.ContentItem.As<FormElementPart>();
    var formInputElementPart = Model.Value.ContentItem.As<FormInputElementPart>();
    var elementId = formElementPart.Id;
    var fieldName = formInputElementPart.Name;
    var fieldId = !string.IsNullOrEmpty(elementId) ? elementId : !string.IsNullOrEmpty(fieldName) ? Html.GenerateIdFromName(fieldName) : default(string);
    var fieldValue = Model.Value.DefaultValue?.Trim();
    var fieldClass = "block w-full rounded-md border-0 py-1.5 px-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600";

    if (ViewData.ModelState.TryGetValue(fieldName, out var fieldEntry))
    {
        fieldValue = fieldEntry.AttemptedValue;
        if (fieldEntry.Errors.Count > 0)
        {
            fieldClass = "form-control input-validation-error is-invalid";
        }
    }
}
<textarea id="@fieldId" name="@fieldName" class="@fieldClass" placeholder="@Model.Value.Placeholder">@fieldValue</textarea>
