This is a migrated thread and some comments may be shown as answers.
Unobtrusive validation attributes applied to invisible input
0 Answers 35 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Geoffrey Hudik
Top achievements
Rank 1
Geoffrey Hudik asked on 04 Nov 2011, 07:04 PM
I have my code setup basically the same as this post:
http://stackoverflow.com/questions/5816313/mvc3-unobtrusive-validation-group-of-inputs

My inputs consist of 2 comboboxes, each which has an autocomplete style (not DropDownList).

The validation attributes are getting applied to the hidden input where the id value gets stored and not the visible control on the page. As a result no error is shown at the control level or in validation summary, even though jquery validate indicates there was in fact an error.

How would I go about solving this issue given the combobox is using 2 different controls?

<div class="t-widget t-combobox t-header" style="width: 650px;"><div class="t-dropdown-wrap t-state-default"><input class="t-input" id="CompanyId-input" name="CompanyId-input" type="text" /><span class="t-select t-header"><span class="t-icon t-arrow-down">select</span></span></div><input data-val="true" data-val-atleastonerequired="Some search criteria must be entered" data-val-atleastonerequired-properties="CompanyId,ProviderStatusId" data-val-number="The field CompanyId must be a number." id="CompanyId" name="CompanyId" style="display:none" type="text" /></div>
Tags
ComboBox
Asked by
Geoffrey Hudik
Top achievements
Rank 1
Share this question
or