bootstrap-autocomplete icon indicating copy to clipboard operation
bootstrap-autocomplete copied to clipboard

Unobstrusive Validation data attributes lost when select is converted to textbox

Open Alexplose opened this issue 6 years ago • 2 comments

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 ?

Alexplose avatar Jul 19 '19 12:07 Alexplose

Hi @Alexplose AFAIK there is no way to copy all attributes. :( But I leave this open if anyone has some suggestions.

xcash avatar Aug 01 '19 09:08 xcash

I'll get that timon fix... :)

xcash avatar Jun 18 '21 06:06 xcash