Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Re-display selected text on blur
posted

Is there a way to reset the displayed text in the dropdown textbox to the selected item's text on blur?

SCENARIO:

  1. User clicks in WDD text box and types a few characters
  2. A full post-back fires to retrieve a list of values to populate the dropdown items with values beginning with the characters typed
  3. User clicks and item and the text value is displayed in the text box by the control(a cascading WDD postback fires here)
  4. At some later point, the user clicks in the WDD textbox again which clears the previously displayed value (though the corresponding item on the list seems to remain selected)
  5. User continues to work through form, but is left with a blank WDD textbox.

I thought something like this, but it's not working.

function wddMedications_Blur(sender, e) {
    sender.set_currentValue($find('<%= wddMedications.ClientID %>').get_selectedItem().get_text(), true);
}

Parents
No Data
Reply
  • 37874
    posted

    Hi johnvrsm,

     

    I would suggest you to try  something like the following code:

     

    function onBlur(sender, args) {

        var selectedItemText = sender.get_selectedItem().get_text();

        sender.get_element().getElementsByTagName('input')[0].value = selectedItemText;

    }

     

    Please let me know if this helps.

Children