From 3e5c9cf951f3feae4560daa82ff3ccecbec54dca Mon Sep 17 00:00:00 2001 From: j3ffb Date: Fri, 25 Oct 2013 15:46:37 +0200 Subject: [PATCH] #19570: TextField does not support the Required Attribute Work Item: 19570 --- src/Orchard.Web/Core/Common/Views/Body-Large.Editor.cshtml | 4 +++- src/Orchard.Web/Core/Common/Views/Body-Small.Editor.cshtml | 4 +++- src/Orchard.Web/Core/Common/Views/Body-Textarea.Editor.cshtml | 4 +++- src/Orchard.Web/Core/Common/Views/Body-Wide.Editor.cshtml | 4 +++- src/Orchard.Web/Core/Common/Views/Body.Editor.cshtml | 4 +++- .../Views/EditorTemplates/Fields.Common.Text.Edit.cshtml | 4 ++-- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Orchard.Web/Core/Common/Views/Body-Large.Editor.cshtml b/src/Orchard.Web/Core/Common/Views/Body-Large.Editor.cshtml index 6800134a0..61d7444b2 100644 --- a/src/Orchard.Web/Core/Common/Views/Body-Large.Editor.cshtml +++ b/src/Orchard.Web/Core/Common/Views/Body-Large.Editor.cshtml @@ -1 +1,3 @@ -@Html.TextBox("Text", (string)Model.Text, new { @class = "text large" }) \ No newline at end of file +@(Model.Required != null && Model.Required + ? Html.TextBox("Text", (string)Model.Text, new { @class = "text large", required = "required" }) + : Html.TextBox("Text", (string)Model.Text, new { @class = "text large" })) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/Body-Small.Editor.cshtml b/src/Orchard.Web/Core/Common/Views/Body-Small.Editor.cshtml index 3298c6f4f..3a92ea209 100644 --- a/src/Orchard.Web/Core/Common/Views/Body-Small.Editor.cshtml +++ b/src/Orchard.Web/Core/Common/Views/Body-Small.Editor.cshtml @@ -1 +1,3 @@ -@Html.TextBox("Text", (string)Model.Text, new { @class = "text small" }) \ No newline at end of file +@(Model.Required != null && Model.Required + ? Html.TextBox("Text", (string)Model.Text, new { @class = "text small", required = "required" }) + : Html.TextBox("Text", (string)Model.Text, new { @class = "text small" })) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/Body-Textarea.Editor.cshtml b/src/Orchard.Web/Core/Common/Views/Body-Textarea.Editor.cshtml index 1e6af76c4..9c2df8336 100644 --- a/src/Orchard.Web/Core/Common/Views/Body-Textarea.Editor.cshtml +++ b/src/Orchard.Web/Core/Common/Views/Body-Textarea.Editor.cshtml @@ -1 +1,3 @@ -@Html.TextArea("Text", (string)Model.Text, 10, 80, new {}) +@(Model.Required != null && Model.Required + ? Html.TextArea("Text", (string)Model.Text, 10, 80, new { required = "required" }) + : Html.TextArea("Text", (string)Model.Text, 10, 80, new { })) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/Body-Wide.Editor.cshtml b/src/Orchard.Web/Core/Common/Views/Body-Wide.Editor.cshtml index 23e1e4cf5..c05afe7a4 100644 --- a/src/Orchard.Web/Core/Common/Views/Body-Wide.Editor.cshtml +++ b/src/Orchard.Web/Core/Common/Views/Body-Wide.Editor.cshtml @@ -1 +1,3 @@ -@Html.TextBox("Text", (string)Model.Text, new { @class = "text medium" }) \ No newline at end of file +@(Model.Required != null && Model.Required + ? Html.TextBox("Text", (string)Model.Text, new { @class = "text medium", required = "required" }) + : Html.TextBox("Text", (string)Model.Text, new { @class = "text medium" })) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/Body.Editor.cshtml b/src/Orchard.Web/Core/Common/Views/Body.Editor.cshtml index f1997f7b3..a3dbe59cf 100644 --- a/src/Orchard.Web/Core/Common/Views/Body.Editor.cshtml +++ b/src/Orchard.Web/Core/Common/Views/Body.Editor.cshtml @@ -2,4 +2,6 @@ @{ string editorFlavor = Model.EditorFlavor; } -@Html.TextArea("Text", (string)Model.Text, 25, 80, new { @class = editorFlavor.HtmlClassify() }) \ No newline at end of file +@(Model.Required != null && Model.Required + ? Html.TextArea("Text", (string)Model.Text, 25, 80, new { @class = editorFlavor.HtmlClassify(), required = "required" }) + : Html.TextArea("Text", (string)Model.Text, 25, 80, new { @class = editorFlavor.HtmlClassify() })) \ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml index d1a769a9f..9dbbc05f3 100644 --- a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml +++ b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Fields.Common.Text.Edit.cshtml @@ -3,11 +3,11 @@
@if (String.IsNullOrWhiteSpace(Model.Settings.Flavor)) { - @Html.TextBoxFor(m => m.Text, new { @class = "text" }) + @(Model.Settings.Required ? Html.TextBoxFor(m => m.Text, new {@class = "text", required = "required"}) : Html.TextBoxFor(m => m.Text, new {@class = "text"})) @Html.ValidationMessageFor(m => m.Text) } else { - @Display.Body_Editor(Text: Model.Text, EditorFlavor: Model.Settings.Flavor) + @Display.Body_Editor(Text: Model.Text, EditorFlavor: Model.Settings.Flavor, Required: Model.Settings.Required) } @if (HasText(Model.Settings.Hint)) { @Model.Settings.Hint