mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-30 01:09:09 +08:00
#19570: TextField does not support the Required Attribute
Work Item: 19570
This commit is contained in:
parent
df60ed18f8
commit
3e5c9cf951
@ -1 +1,3 @@
|
|||||||
@Html.TextBox("Text", (string)Model.Text, new { @class = "text large" })
|
@(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" }))
|
@ -1 +1,3 @@
|
|||||||
@Html.TextBox("Text", (string)Model.Text, new { @class = "text small" })
|
@(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" }))
|
@ -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 { }))
|
@ -1 +1,3 @@
|
|||||||
@Html.TextBox("Text", (string)Model.Text, new { @class = "text medium" })
|
@(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" }))
|
@ -2,4 +2,6 @@
|
|||||||
@{
|
@{
|
||||||
string editorFlavor = Model.EditorFlavor;
|
string editorFlavor = Model.EditorFlavor;
|
||||||
}
|
}
|
||||||
@Html.TextArea("Text", (string)Model.Text, 25, 80, new { @class = editorFlavor.HtmlClassify() })
|
@(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() }))
|
@ -3,11 +3,11 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="@Html.FieldIdFor(m => m.Text)" @if(Model.Settings.Required) { <text>class="required"</text> }>@Model.Field.DisplayName</label>
|
<label for="@Html.FieldIdFor(m => m.Text)" @if(Model.Settings.Required) { <text>class="required"</text> }>@Model.Field.DisplayName</label>
|
||||||
@if (String.IsNullOrWhiteSpace(Model.Settings.Flavor)) {
|
@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)
|
@Html.ValidationMessageFor(m => m.Text)
|
||||||
}
|
}
|
||||||
else {
|
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)) {
|
@if (HasText(Model.Settings.Hint)) {
|
||||||
<span class="hint">@Model.Settings.Hint</span>
|
<span class="hint">@Model.Settings.Hint</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user