bootstrap-autocomplete
bootstrap-autocomplete copied to clipboard
Unobstrusive Validation data attributes lost when select is converted to textbox
Here is the code before autocomplete is applied :
<select class="form-control postCodeAutoComplete" autocomplete="off" data-url="/api/Ajax/GetPostCode" placeholder="Code postal..." data-noresults-text="Pas de résultats" **data-val="true" data-val-required="The ID field is required."** id="PostalCode_ID" name="PostalCode.ID">
<option selected="selected" value="5030">31400</option>
</select>
<span class="text-danger field-validation-valid" data-valmsg-for="PostalCode.ID" data-valmsg-replace="true"></span>
</div>
and After autoComplete is applied 👍
<input type="text" name="PostalCode.ID_text" id="PostalCode_ID" placeholder="Code postal..." autocomplete="off" class="form-control postCodeAutoComplete"><input type="hidden" name="PostalCode.ID" value="5030">
<span class="text-danger field-validation-valid" data-valmsg-for="PostalCode.ID" data-valmsg-replace="true"></span>
Is there any way to copy all existing attributes to the newly created element, when convertToTextBox is called ?
Hi @Alexplose AFAIK there is no way to copy all attributes. :( But I leave this open if anyone has some suggestions.
I'll get that timon fix... :)