Hi,
I'm trying to use igCombo as a replacement for DropDownListFor in my MVC application, as it offers things like autocomplete and filtering of selectable data. All that works just fine, but one things is not working as I want it to. I only use Infragistics components for my dropdownlists in my form, using the standard html helpers for all other input fields. When submitting the form, igCombo fields shows it's own error message (using igValidator), replacing the ValidationMessageFor I want to show in order to keep messages localized and in the same format. I'm working with the MVC html helper of igCombo.
I need help to etiher disable/prevent/redirect this validation error message to use ValidationMessageFor instead of it's own validation message.
I'm using Infragistics 2015.2 with the latest jquery and jqueryui.
Sample code:
<div class="col-md-8">
@(Html.Infragistics().ComboFor(model => model.CountryID)
.PlaceHolder(DtoResource.Select_country)
.AutoComplete(true)
.EnableClearButton(true)
.AllowCustomValue(false)
.ValidatorOptions(options => options.OnBlur(false).OnChange(false).OnSubmit(true))
.FilteringCondition(ComboFilteringCondition.StartsWith)
.HighlightMatchesMode(ComboHighlightMatchesMode.StartsWith)
.DataSource(ViewBag.Countries)
.ValueKey("Value")
.TextKey("Text")
.DataBind()
.Render()
)
@Html.ValidationMessageFor(model => model.CountryID, "", new { @class = "text-danger" })
@*@Html.DropDownListFor(model => model.CountryID, (SelectList)ViewBag.Countries, DtoResource.Select_country, htmlAttributes: new { @class = "form-control" })*@
</div>
Regards
FW
Hello Fredrik,
I was unable to reproduce this behavior. Attached is a sample with ValidatorMessageFor with igCombo. Let me know if you have the same results in your environment. Feel free to modify the sample if you feel that this is not an accurate representation of what you are trying to achieve.
Can you give me more details as to what you are trying to achieve within the ValidatorMessageFor? In the case of the igCombo, you have access to ValidatorOptions which you can use to set the values of the igValidator. You can read up on the options available here: http://help.infragistics.com/jQuery/2015.2/ui.igvalidator