如何在 Orchard 中使用 `HTML <input> placeholder Attribute` 实现动态表单

How to achieve Dynamic forms with `HTML <input> placeholder Attribute` in Orchard

我用Orchard CMS 1.10.1。如何在 dynamic forms 模块中使用 HTML <input> placeholder Attribute 而不是标签?

使用设计器工具模块中的形状追踪功能找到要覆盖的正确形状,以及要编写的替代模板。很可能,您会发现需要覆盖 Elements_TextField 形状并替换:

@if (element.ShowLabel) {
    <label for="@element.HtmlId">@Model.ProcessedLabel</label>
}

与:

@if (element.ShowLabel) {
    tagBuilder.Attributes["placeholder"] = Model.ProcessedLabel;
}