First i'm using ASP.Net MVC4 and latest jQuery 2.0.3, jQuery mobile 1.3.1, jQuery UI 1.10.3 and jQuery Unobstrusive Validation Plugin 1.11.1
I got a probleme with jQuery validation.. it confounds the display text of the select list and the error message...
So jQuery validate adds the class "input-validation-error" to this html element when error occurs.. My problem is that when i choose a valid value and submit (with other errors in the form) jquery adds a style="display:none" to this span ! So my select list appears like nothing was selected...
The span element concerned :
<span>Select a card</span>
The Html code below is generated with :
@Html.LabelFor(model => model.CardType)
@Html.DropDownListFor(model => model.CardType, Model.CardList)
and the submit button :
<button type="submit" data-transition="flip" data-theme="e" data-role="button">Buy</button>
Here is an exemple :
Initial state of generated select list :
<div class="ui-select">
<div data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-icon="arrow-d" data-iconpos="right" data-theme="c" class="ui-btn ui-btn-up-c ui-shadow ui-btn-corner-all ui-btn-icon-right">
<span class="ui-btn-inner">
<span class="ui-btn-text">
<span>Select a card</span>
</span>
<span class="ui-icon ui-icon-arrow-d ui-icon-shadow"> </span>
</span>
<select data-val="true" data-val-required="Please select a payment card" id="CardType" name="CardType">
<option value="">Select a card</option>
<option value="Visa">Visa</option>
<option value="AmericanExpress">American Express</option>
<option value="MasterCardPrepago">MasterCard Prepago</option>
<option value="EuroCardMasterCard">EuroCard / MasterCard</option>
<option value="CarteBleue">Carte bleue nationale</option>
<option value="VisaDebit">Visa Debit</option>
<option value="VisaElectron">Visa Electron</option>
</select>
</div>
</div>
So how do i say to jquery validate to not use the span created by jquery mobile as an error field ?!
Thanks