asp.net mvc - knockout validation with typeahead combobox plugin -


i trying use knockout validation in combination bootstrap combobox plugin.

i have select control bound observable property has required attribute (for ko validation).

 <select data-bind="attr: { options: typeaheadsource, value: xyz, validationoptions: {errorelementclass: 'input-validation-error'}, typeaheadcombobox: {}"></select> 

i have custom binding associated select control in call bootstrap combobox plugin. creates div input control on select control , hides select control.

the knockout validation fires when dont select value in comobox , shows error message next control field not highlighted. here how looks like

enter image description here

as can see, error message shows input field not highlighted.

here final html generated when validation fires.

    <div class="combobox-container">     <input style="position:static;" type="text" autocomplete="off" data-bind="{ value: name, validationoptions: { errorelementclass: 'input-validation-error' }" class="input-large"> <span class="add-on btn dropdown-toggle" data-dropdown="dropdown"><span class="caret"></span> <span class="combobox-clear"><i class="icon-remove"></i></span></span> <select data-bind="validationoptions: { errorelementclass: 'input-validation-error' }, options: typeaheadsource, value: name, typeaheadsimplecombobox: { }" class="combobox input-validation-error"></select>     </div> 

as can see, select control (which hidden plugin) gets validation error class defined ('input-validation-error') input control created plugin not. main issue here.

so, thought becasue input control not directly bound property. so, tried adding same value binding select control input control created plugin inside custom binding. added validationoptions binding. these changes didnt work either.

strange thing have typeahead textbox bound property uses similar design (custom binding create typeahead plugin on input control) , validation + highlighting works on that. here final html that.

<input type="text" data-bind="value: xyz, validationoptions: { errorelementclass: 'input-validation-error' }, typeaheadtextbox: { source: $data.typeaheadsource }" class="typeaheadvalue input-mini" data-provide="customtypeahead" autocomplete="off"> 

could tell me if missing additional steps. sure might need more details. please leave comment , try add more details.

thanks.

i figured issue. in case has same issue, here did. though setting value bindings on input control created plugin, bindings applied before control created , so, had reapply bindings on input control created plugin. did trick me.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -