mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#21224: Added validation for Enumeration, Taxonomy and Query form field elements.
Work Item: 21224
This commit is contained in:
@@ -19,11 +19,12 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
_tokenizer = tokenizer;
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> FormNames {
|
||||
get {
|
||||
yield return "AutoLabel";
|
||||
yield return "Enumeration";
|
||||
}
|
||||
protected override EditorResult OnBuildEditor(Enumeration element, ElementEditorContext context) {
|
||||
var autoLabelEditor = BuildForm(context, "AutoLabel");
|
||||
var enumerationEditor = BuildForm(context, "Enumeration");
|
||||
var checkBoxValidation = BuildForm(context, "EnumerationValidation", "Validation:10");
|
||||
|
||||
return Editor(context, autoLabelEditor, enumerationEditor, checkBoxValidation);
|
||||
}
|
||||
|
||||
protected override void DescribeForm(DescribeContext context) {
|
||||
@@ -50,6 +51,32 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
|
||||
return form;
|
||||
});
|
||||
|
||||
context.Form("EnumerationValidation", factory => {
|
||||
var shape = (dynamic)factory;
|
||||
var form = shape.Fieldset(
|
||||
Id: "EnumerationValidation",
|
||||
_IsRequired: shape.Checkbox(
|
||||
Id: "Required",
|
||||
Name: "Required",
|
||||
Title: "Required",
|
||||
Value: "true",
|
||||
Description: T("Tick this checkbox to make at least one option required.")),
|
||||
_CustomValidationMessage: shape.Textbox(
|
||||
Id: "CustomValidationMessage",
|
||||
Name: "CustomValidationMessage",
|
||||
Title: "Custom Validation Message",
|
||||
Classes: new[] { "text", "large", "tokenized" },
|
||||
Description: T("Optionally provide a custom validation message.")),
|
||||
_ShowValidationMessage: shape.Checkbox(
|
||||
Id: "ShowValidationMessage",
|
||||
Name: "ShowValidationMessage",
|
||||
Title: "Show Validation Message",
|
||||
Value: "true",
|
||||
Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));
|
||||
|
||||
return form;
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Enumeration element, ElementDisplayContext context) {
|
||||
@@ -59,7 +86,7 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
|
||||
context.ElementShape.TokenizedOptions = tokenizedOptions;
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}", typeName, element.InputType));
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}__{2}", displayType, typeName, element.InputType));
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,11 +30,12 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
_tokenizer = tokenizer;
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> FormNames {
|
||||
get {
|
||||
yield return "AutoLabel";
|
||||
yield return "QueryForm";
|
||||
}
|
||||
protected override EditorResult OnBuildEditor(Query element, ElementEditorContext context) {
|
||||
var autoLabelEditor = BuildForm(context, "AutoLabel");
|
||||
var enumerationEditor = BuildForm(context, "QueryForm");
|
||||
var checkBoxValidation = BuildForm(context, "QueryValidation", "Validation:10");
|
||||
|
||||
return Editor(context, autoLabelEditor, enumerationEditor, checkBoxValidation);
|
||||
}
|
||||
|
||||
protected override void DescribeForm(DescribeContext context) {
|
||||
@@ -87,6 +88,32 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
|
||||
return form;
|
||||
});
|
||||
|
||||
context.Form("QueryValidation", factory => {
|
||||
var shape = (dynamic)factory;
|
||||
var form = shape.Fieldset(
|
||||
Id: "QueryValidation",
|
||||
_IsRequired: shape.Checkbox(
|
||||
Id: "Required",
|
||||
Name: "Required",
|
||||
Title: "Required",
|
||||
Value: "true",
|
||||
Description: T("Tick this checkbox to make at least one option required.")),
|
||||
_CustomValidationMessage: shape.Textbox(
|
||||
Id: "CustomValidationMessage",
|
||||
Name: "CustomValidationMessage",
|
||||
Title: "Custom Validation Message",
|
||||
Classes: new[] { "text", "large", "tokenized" },
|
||||
Description: T("Optionally provide a custom validation message.")),
|
||||
_ShowValidationMessage: shape.Checkbox(
|
||||
Id: "ShowValidationMessage",
|
||||
Name: "ShowValidationMessage",
|
||||
Title: "Show Validation Message",
|
||||
Value: "true",
|
||||
Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));
|
||||
|
||||
return form;
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Query element, ElementDisplayContext context) {
|
||||
@@ -96,8 +123,8 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
var displayType = context.DisplayType;
|
||||
|
||||
context.ElementShape.Options = GetOptions(element, queryId).ToArray();
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Element__{0}__{1}__{2}", category, typeName, element.InputType));
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Element_{0}__{1}__{2}__{3}", displayType, category, typeName, element.InputType));
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}", typeName, element.InputType));
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
|
||||
}
|
||||
|
||||
private IEnumerable<SelectListItem> GetOptions(Query element, int? queryId) {
|
||||
|
||||
@@ -25,11 +25,12 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
_tokenizer = tokenizer;
|
||||
}
|
||||
|
||||
protected override IEnumerable<string> FormNames {
|
||||
get {
|
||||
yield return "AutoLabel";
|
||||
yield return "TaxonomyForm";
|
||||
}
|
||||
protected override EditorResult OnBuildEditor(Taxonomy element, ElementEditorContext context) {
|
||||
var autoLabelEditor = BuildForm(context, "AutoLabel");
|
||||
var enumerationEditor = BuildForm(context, "TaxonomyForm");
|
||||
var checkBoxValidation = BuildForm(context, "TaxonomyValidation", "Validation:10");
|
||||
|
||||
return Editor(context, autoLabelEditor, enumerationEditor, checkBoxValidation);
|
||||
}
|
||||
|
||||
protected override void DescribeForm(DescribeContext context) {
|
||||
@@ -91,6 +92,32 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
|
||||
return form;
|
||||
});
|
||||
|
||||
context.Form("TaxonomyValidation", factory => {
|
||||
var shape = (dynamic)factory;
|
||||
var form = shape.Fieldset(
|
||||
Id: "TaxonomyValidation",
|
||||
_IsRequired: shape.Checkbox(
|
||||
Id: "Required",
|
||||
Name: "Required",
|
||||
Title: "Required",
|
||||
Value: "true",
|
||||
Description: T("Tick this checkbox to make at least one option required.")),
|
||||
_CustomValidationMessage: shape.Textbox(
|
||||
Id: "CustomValidationMessage",
|
||||
Name: "CustomValidationMessage",
|
||||
Title: "Custom Validation Message",
|
||||
Classes: new[] { "text", "large", "tokenized" },
|
||||
Description: T("Optionally provide a custom validation message.")),
|
||||
_ShowValidationMessage: shape.Checkbox(
|
||||
Id: "ShowValidationMessage",
|
||||
Name: "ShowValidationMessage",
|
||||
Title: "Show Validation Message",
|
||||
Value: "true",
|
||||
Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));
|
||||
|
||||
return form;
|
||||
});
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Taxonomy element, ElementDisplayContext context) {
|
||||
@@ -100,7 +127,7 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
|
||||
context.ElementShape.TermOptions = GetTermOptions(element, taxonomyId).ToArray();
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}", typeName, element.InputType));
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}__{2}", displayType, typeName, element.InputType));
|
||||
context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
|
||||
}
|
||||
|
||||
private IEnumerable<SelectListItem> GetTermOptions(Taxonomy element, int? taxonomyId) {
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.DynamicForms.Validators.Settings;
|
||||
using Orchard.Layouts.Helpers;
|
||||
|
||||
namespace Orchard.DynamicForms.Elements {
|
||||
@@ -22,6 +23,10 @@ namespace Orchard.DynamicForms.Elements {
|
||||
set { this.Store(x => x.InputType, value); }
|
||||
}
|
||||
|
||||
public EnumerationValidationSettings ValidationSettings {
|
||||
get { return Data.GetModel<EnumerationValidationSettings>(""); }
|
||||
}
|
||||
|
||||
private IEnumerable<SelectListItem> GetOptions() {
|
||||
return ParseOptionsText();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.DynamicForms.Validators.Settings;
|
||||
using Orchard.Layouts.Helpers;
|
||||
|
||||
namespace Orchard.DynamicForms.Elements {
|
||||
public class Query : LabeledFormElement {
|
||||
@@ -25,5 +26,9 @@ namespace Orchard.DynamicForms.Elements {
|
||||
public string ValueExpression {
|
||||
get { return this.Retrieve(x => x.ValueExpression, () => "{Content.Id}"); }
|
||||
}
|
||||
|
||||
public EnumerationValidationSettings ValidationSettings {
|
||||
get { return Data.GetModel<EnumerationValidationSettings>(""); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.DynamicForms.Validators.Settings;
|
||||
using Orchard.Layouts.Helpers;
|
||||
|
||||
namespace Orchard.DynamicForms.Elements {
|
||||
public class Taxonomy : LabeledFormElement {
|
||||
@@ -32,5 +33,9 @@ namespace Orchard.DynamicForms.Elements {
|
||||
get { return this.Retrieve(x => x.ValueExpression); }
|
||||
set { this.Store(x => x.ValueExpression, value); }
|
||||
}
|
||||
|
||||
public EnumerationValidationSettings ValidationSettings {
|
||||
get { return Data.GetModel<EnumerationValidationSettings>(""); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,15 +210,20 @@
|
||||
<Compile Include="Services\ValidationRuleFactory.cs" />
|
||||
<Compile Include="Services\IValidationRule.cs" />
|
||||
<Compile Include="Tokens\FormTokens.cs" />
|
||||
<Compile Include="ValidationRules\OptionRequired.cs" />
|
||||
<Compile Include="ValidationRules\Mandatory.cs" />
|
||||
<Compile Include="ValidationRules\Compare.cs" />
|
||||
<Compile Include="ValidationRules\EmailAddress.cs" />
|
||||
<Compile Include="ValidationRules\RegularExpression.cs" />
|
||||
<Compile Include="ValidationRules\StringLength.cs" />
|
||||
<Compile Include="Validators\QueryValidator.cs" />
|
||||
<Compile Include="Validators\TaxonomyValidator.cs" />
|
||||
<Compile Include="Validators\EnumerationValidator.cs" />
|
||||
<Compile Include="Validators\CheckBoxValidator.cs" />
|
||||
<Compile Include="ValidationRules\Required.cs" />
|
||||
<Compile Include="Services\ValidationRule.cs" />
|
||||
<Compile Include="Validators\EmailFieldValidator.cs" />
|
||||
<Compile Include="Validators\Settings\EnumerationValidationSettings.cs" />
|
||||
<Compile Include="Validators\Settings\CheckBoxValidationSettings.cs" />
|
||||
<Compile Include="Validators\Settings\EmailFieldValidationSettings.cs" />
|
||||
<Compile Include="Validators\Settings\PasswordFieldValidationSettings.cs" />
|
||||
@@ -467,6 +472,42 @@
|
||||
<DependentUpon>Forms.min.js</DependentUpon>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Enumeration-RadioList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Enumeration-CheckList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Enumeration-SelectList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Enumeration-MultiSelectList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Taxonomy-CheckList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Taxonomy-MultiSelectList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Taxonomy-RadioList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Taxonomy-SelectList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Query-CheckList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Query-MultiSelectList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Query-RadioList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Elements\Query-SelectList.Design.cshtml" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
(function ($) {
|
||||
|
||||
$.validator.addMethod("optionrequired", function (value, element, param) {
|
||||
var isValid = true;
|
||||
|
||||
if ($(element).is("input")) {
|
||||
var parent = $(element).closest("ol");
|
||||
|
||||
isValid = parent.find("input:checked").length > 0;
|
||||
parent.toggleClass("input-validation-error", !isValid);
|
||||
}
|
||||
else if ($(element).is("select")) {
|
||||
var v = $(element).val();
|
||||
isValid = !!v && v.length > 0;
|
||||
}
|
||||
|
||||
return isValid;
|
||||
}, "An option is required");
|
||||
|
||||
$.validator.unobtrusive.adapters.addBool("mandatory", "required");
|
||||
$.validator.unobtrusive.adapters.addBool("optionrequired");
|
||||
}(jQuery));
|
||||
@@ -22,8 +22,4 @@
|
||||
***************************************************************/
|
||||
.form-field-element {
|
||||
margin: 0.8em 0 0 0;
|
||||
}
|
||||
|
||||
.form-field-element-enumeration select {
|
||||
margin: 1.5em 0 0 0;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using Orchard.DynamicForms.Services.Models;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.DynamicForms.ValidationRules {
|
||||
public class Mandatory : ValidationRule {
|
||||
public class Mandatory : ValidationRule {
|
||||
public override void Validate(ValidateInputContext context) {
|
||||
if (String.IsNullOrWhiteSpace(context.AttemptedValue)) {
|
||||
var message = GetValidationMessage(context);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Orchard.DynamicForms.Helpers;
|
||||
using Orchard.DynamicForms.Services;
|
||||
using Orchard.DynamicForms.Services.Models;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.DynamicForms.ValidationRules {
|
||||
public class OptionRequired : ValidationRule {
|
||||
public override void Validate(ValidateInputContext context) {
|
||||
if (String.IsNullOrWhiteSpace(context.AttemptedValue)) {
|
||||
var message = GetValidationMessage(context);
|
||||
context.ModelState.AddModelError(context.FieldName, message.Text);
|
||||
}
|
||||
}
|
||||
|
||||
public override void RegisterClientAttributes(RegisterClientValidationAttributesContext context) {
|
||||
context.ClientAttributes["data-val-optionrequired"] = GetValidationMessage(context).Text;
|
||||
}
|
||||
|
||||
private LocalizedString GetValidationMessage(ValidationContext context) {
|
||||
return T(Tokenize(ErrorMessage.WithDefault(String.Format("An option is required for {0}.", context.FieldName)), context));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.DynamicForms.Elements;
|
||||
using Orchard.DynamicForms.Services;
|
||||
using Orchard.DynamicForms.ValidationRules;
|
||||
|
||||
namespace Orchard.DynamicForms.Validators {
|
||||
public class EnumerationValidator : ElementValidator<Enumeration> {
|
||||
private readonly IValidationRuleFactory _validationRuleFactory;
|
||||
public EnumerationValidator(IValidationRuleFactory validationRuleFactory) {
|
||||
_validationRuleFactory = validationRuleFactory;
|
||||
}
|
||||
|
||||
protected override IEnumerable<IValidationRule> GetValidationRules(Enumeration element) {
|
||||
var settings = element.ValidationSettings;
|
||||
|
||||
if (settings.Required == true)
|
||||
yield return _validationRuleFactory.Create<OptionRequired>(settings.CustomValidationMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.DynamicForms.Elements;
|
||||
using Orchard.DynamicForms.Services;
|
||||
using Orchard.DynamicForms.ValidationRules;
|
||||
|
||||
namespace Orchard.DynamicForms.Validators {
|
||||
public class QueryValidator : ElementValidator<Query> {
|
||||
private readonly IValidationRuleFactory _validationRuleFactory;
|
||||
public QueryValidator(IValidationRuleFactory validationRuleFactory) {
|
||||
_validationRuleFactory = validationRuleFactory;
|
||||
}
|
||||
|
||||
protected override IEnumerable<IValidationRule> GetValidationRules(Query element) {
|
||||
var settings = element.ValidationSettings;
|
||||
|
||||
if (settings.Required == true)
|
||||
yield return _validationRuleFactory.Create<OptionRequired>(settings.CustomValidationMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using Orchard.DynamicForms.Services.Models;
|
||||
|
||||
namespace Orchard.DynamicForms.Validators.Settings {
|
||||
public class EnumerationValidationSettings : ValidationSettingsBase {
|
||||
public bool? Required { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.DynamicForms.Elements;
|
||||
using Orchard.DynamicForms.Services;
|
||||
using Orchard.DynamicForms.ValidationRules;
|
||||
|
||||
namespace Orchard.DynamicForms.Validators {
|
||||
public class TaxonomyValidator : ElementValidator<Taxonomy> {
|
||||
private readonly IValidationRuleFactory _validationRuleFactory;
|
||||
public TaxonomyValidator(IValidationRuleFactory validationRuleFactory) {
|
||||
_validationRuleFactory = validationRuleFactory;
|
||||
}
|
||||
|
||||
protected override IEnumerable<IValidationRule> GetValidationRules(Taxonomy element) {
|
||||
var settings = element.ValidationSettings;
|
||||
|
||||
if (settings.Required == true)
|
||||
yield return _validationRuleFactory.Create<OptionRequired>(settings.CustomValidationMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@using Orchard.DisplayManagement.Shapes
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Enumeration)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.TokenizedOptions) {
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="@element.Name" value="@option.Value" />
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@@ -4,17 +4,29 @@
|
||||
@{
|
||||
var element = (Enumeration)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
var index = 0;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.TokenizedOptions) {
|
||||
var inputTagBuilder = new OrchardTagBuilder("input");
|
||||
inputTagBuilder.Attributes["type"] = "checkbox";
|
||||
inputTagBuilder.Attributes["name"] = element.Name;
|
||||
inputTagBuilder.Attributes["value"] = option.Value;
|
||||
if (element.ValidationSettings.Required == true && index == 0) {
|
||||
inputTagBuilder.AddClientValidationAttributes((IDictionary<string, string>)Model.ClientValidationAttributes);
|
||||
}
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="@element.Name" value="@option.Value" />
|
||||
@Html.Raw(inputTagBuilder.ToString(TagRenderMode.SelfClosing))
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
++index;
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@tagBuilder.EndElement
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Enumeration)Model.Element;
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "MultiSelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.TokenizedOptions;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@@ -5,8 +5,17 @@
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "MultiSelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.TokenizedOptions;
|
||||
var clientValidationAttributes = (IDictionary<string, string>)Model.ClientValidationAttributes;
|
||||
var htmlId = !String.IsNullOrWhiteSpace(element.HtmlId) ? element.HtmlId : name;
|
||||
|
||||
foreach (var attribute in clientValidationAttributes) {
|
||||
attributes.Add(attribute.Key, attribute.Value);
|
||||
}
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
<label for="@htmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@using Orchard.DisplayManagement.Shapes
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Enumeration)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.TokenizedOptions) {
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="@element.Name" value="@option.Value" />
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@@ -4,17 +4,29 @@
|
||||
@{
|
||||
var element = (Enumeration)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
var index = 0;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.TokenizedOptions) {
|
||||
<li>
|
||||
var inputTagBuilder = new OrchardTagBuilder("input");
|
||||
inputTagBuilder.Attributes["type"] = "radio";
|
||||
inputTagBuilder.Attributes["name"] = element.Name;
|
||||
inputTagBuilder.Attributes["value"] = option.Value;
|
||||
if (element.ValidationSettings.Required == true && index == 0) {
|
||||
inputTagBuilder.AddClientValidationAttributes((IDictionary<string, string>) Model.ClientValidationAttributes);
|
||||
}
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="@element.Name" value="@option.Value" />
|
||||
@Html.Raw(inputTagBuilder.ToString(TagRenderMode.SelfClosing))
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
++index;
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@tagBuilder.EndElement
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Enumeration)Model.Element;
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "SelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.TokenizedOptions;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@@ -5,8 +5,17 @@
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "SelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.TokenizedOptions;
|
||||
var clientValidationAttributes = (IDictionary<string, string>)Model.ClientValidationAttributes;
|
||||
var htmlId = !String.IsNullOrWhiteSpace(element.HtmlId) ? element.HtmlId : name;
|
||||
|
||||
foreach (var attribute in clientValidationAttributes) {
|
||||
attributes.Add(attribute.Key, attribute.Value);
|
||||
}
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
<label for="@htmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@using Orchard.DisplayManagement.Shapes
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Query)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.Options) {
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="@element.Name" value="@option.Value" />
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@@ -4,17 +4,29 @@
|
||||
@{
|
||||
var element = (Query)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
var index = 0;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.Options) {
|
||||
var inputTagBuilder = new OrchardTagBuilder("input");
|
||||
inputTagBuilder.Attributes["type"] = "checkbox";
|
||||
inputTagBuilder.Attributes["name"] = element.Name;
|
||||
inputTagBuilder.Attributes["value"] = option.Value;
|
||||
if (element.ValidationSettings.Required == true && index == 0) {
|
||||
inputTagBuilder.AddClientValidationAttributes((IDictionary<string, string>)Model.ClientValidationAttributes);
|
||||
}
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="@element.Name" value="@option.Value" />
|
||||
@Html.Raw(inputTagBuilder.ToString(TagRenderMode.SelfClosing))
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
++index;
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@tagBuilder.EndElement
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Query)Model.Element;
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "MultiSelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.Options;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@@ -5,8 +5,17 @@
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "MultiSelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.Options;
|
||||
var clientValidationAttributes = (IDictionary<string, string>)Model.ClientValidationAttributes;
|
||||
var htmlId = !String.IsNullOrWhiteSpace(element.HtmlId) ? element.HtmlId : name;
|
||||
|
||||
foreach (var attribute in clientValidationAttributes) {
|
||||
attributes.Add(attribute.Key, attribute.Value);
|
||||
}
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
<label for="@htmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@using Orchard.DisplayManagement.Shapes
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Query)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.Options) {
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="@element.Name" value="@option.Value" />
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@@ -4,17 +4,29 @@
|
||||
@{
|
||||
var element = (Query)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
var index = 0;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.Options) {
|
||||
var inputTagBuilder = new OrchardTagBuilder("input");
|
||||
inputTagBuilder.Attributes["type"] = "radio";
|
||||
inputTagBuilder.Attributes["name"] = element.Name;
|
||||
inputTagBuilder.Attributes["value"] = option.Value;
|
||||
if (element.ValidationSettings.Required == true && index == 0) {
|
||||
inputTagBuilder.AddClientValidationAttributes((IDictionary<string, string>)Model.ClientValidationAttributes);
|
||||
}
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="@element.Name" value="@option.Value" />
|
||||
@Html.Raw(inputTagBuilder.ToString(TagRenderMode.SelfClosing))
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
++index;
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@tagBuilder.EndElement
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Query)Model.Element;
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "SelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.Options;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@@ -5,8 +5,17 @@
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "SelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.Options;
|
||||
var clientValidationAttributes = (IDictionary<string, string>)Model.ClientValidationAttributes;
|
||||
var htmlId = !String.IsNullOrWhiteSpace(element.HtmlId) ? element.HtmlId : name;
|
||||
|
||||
foreach (var attribute in clientValidationAttributes) {
|
||||
attributes.Add(attribute.Key, attribute.Value);
|
||||
}
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
<label for="@htmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@using Orchard.DisplayManagement.Shapes
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Taxonomy)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.TermOptions) {
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="@element.Name" value="@option.Value" />
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@@ -4,17 +4,29 @@
|
||||
@{
|
||||
var element = (Taxonomy)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
var index = 0;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.TermOptions) {
|
||||
var inputTagBuilder = new OrchardTagBuilder("input");
|
||||
inputTagBuilder.Attributes["type"] = "checkbox";
|
||||
inputTagBuilder.Attributes["name"] = element.Name;
|
||||
inputTagBuilder.Attributes["value"] = option.Value;
|
||||
if (element.ValidationSettings.Required == true && index == 0) {
|
||||
inputTagBuilder.AddClientValidationAttributes((IDictionary<string, string>)Model.ClientValidationAttributes);
|
||||
}
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="@element.Name" value="@option.Value" />
|
||||
@Html.Raw(inputTagBuilder.ToString(TagRenderMode.SelfClosing))
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
++index;
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@tagBuilder.EndElement
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Taxonomy)Model.Element;
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "MultiSelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.TermOptions;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@@ -5,8 +5,17 @@
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "MultiSelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.TermOptions;
|
||||
var clientValidationAttributes = (IDictionary<string, string>)Model.ClientValidationAttributes;
|
||||
var htmlId = !String.IsNullOrWhiteSpace(element.HtmlId) ? element.HtmlId : name;
|
||||
|
||||
foreach (var attribute in clientValidationAttributes) {
|
||||
attributes.Add(attribute.Key, attribute.Value);
|
||||
}
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
<label for="@htmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@Html.ListBox(name, options, attributes)
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@using Orchard.DisplayManagement.Shapes
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Taxonomy)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.TermOptions) {
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="@element.Name" value="@option.Value" />
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@@ -4,17 +4,29 @@
|
||||
@{
|
||||
var element = (Taxonomy)Model.Element;
|
||||
var tagBuilder = (OrchardTagBuilder)TagBuilderExtensions.AddCommonElementAttributes(new OrchardTagBuilder("ol"), Model);
|
||||
var index = 0;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label>@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@tagBuilder.StartElement
|
||||
@foreach (var option in Model.TermOptions) {
|
||||
var inputTagBuilder = new OrchardTagBuilder("input");
|
||||
inputTagBuilder.Attributes["type"] = "radio";
|
||||
inputTagBuilder.Attributes["name"] = element.Name;
|
||||
inputTagBuilder.Attributes["value"] = option.Value;
|
||||
if (element.ValidationSettings.Required == true && index == 0) {
|
||||
inputTagBuilder.AddClientValidationAttributes((IDictionary<string, string>)Model.ClientValidationAttributes);
|
||||
}
|
||||
<li>
|
||||
<label>
|
||||
<input type="radio" name="@element.Name" value="@option.Value" />
|
||||
@Html.Raw(inputTagBuilder.ToString(TagRenderMode.SelfClosing))
|
||||
@option.Text
|
||||
</label>
|
||||
</li>
|
||||
++index;
|
||||
}
|
||||
@tagBuilder.EndElement
|
||||
@tagBuilder.EndElement
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
@using Orchard.DynamicForms.Elements
|
||||
@using Orchard.Layouts.Helpers
|
||||
@{
|
||||
var element = (Taxonomy)Model.Element;
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "SelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.TermOptions;
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@@ -5,8 +5,17 @@
|
||||
var attributes = (IDictionary<string, object>)TagBuilderExtensions.GetCommonElementAttributes(Model);
|
||||
var name = String.IsNullOrWhiteSpace(element.Name) ? "SelectList1" : element.Name;
|
||||
var options = (IEnumerable<SelectListItem>)Model.TermOptions;
|
||||
var clientValidationAttributes = (IDictionary<string, string>)Model.ClientValidationAttributes;
|
||||
var htmlId = !String.IsNullOrWhiteSpace(element.HtmlId) ? element.HtmlId : name;
|
||||
|
||||
foreach (var attribute in clientValidationAttributes) {
|
||||
attributes.Add(attribute.Key, attribute.Value);
|
||||
}
|
||||
}
|
||||
@if (element.ShowLabel) {
|
||||
<label for="@element.HtmlId">@Html.Raw(element.Label)</label>
|
||||
<label for="@htmlId">@Html.Raw(element.Label)</label>
|
||||
}
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@Html.DropDownList(name, options, attributes)
|
||||
@if (element.ValidationSettings.ShowValidationMessage == true) {
|
||||
@Html.ValidationMessage(element.Name)
|
||||
}
|
||||
Reference in New Issue
Block a user