For some reason fields named with '.value' or .anything does not generate client validation. For example this code:
@Html.TextArea("ContentObjectFirm.Description")
generates this:
<textarea rows="2" name="ContentObjectFirm.Description" id="ContentObjectFirm_Description" data-val-required="Firm description is required" data-val="true" cols="20"></textarea>
notice "data-val-required"
Now, I NEED to have the field named "ContentObjectFirm.Description.Value" - i'm using a custom binder here (not related to my question however). The bottom line is, is that I need to have '.Value' in the name of the field. So,
for this code: @Html.TextArea("ContentObjectFirm.Description.Value")
Text area helper generates:
<textarea rows="2" name="ContentObjectFirm.Description.Value" id="ContentObjectFirm_Description_Value" cols="20"></textarea>
MODEL class:
[Required(ErrorMessageResourceName = "fld_Description_val_Required", ErrorMessageResourceType = typeof(Resources.Service.Controllers.Firm))]
[Display(Name = "fld_Description_lbl", ResourceType = typeof(Resources.Service.Controllers.Firm))]
public MultilanguageProperty<string> Description
{
get
{
return this.GetMultilanguageProperty("Description", string.Empty, this);
}
set
{
this.SetMultilanguageProperty("Description", value);
}
}
where MultilanguageProperty is my custom interface (unimportant)..when using 'string Description' it still doesn't work.
how do i make it so that Unobtrusive validation code will be added? why is it skipped when .value string is added?.
thanks