jQuery UI Widgets Forums Lists DropDownList How to unset values of a dropdown

This topic contains 2 replies, has 2 voices, and was last updated by  antonomase 10 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • How to unset values of a dropdown #47955

    antonomase
    Participant

    Hi,

    I have a form with some fields. One of them is a dropdown.
    When the form is loaded, the dropdown list can be set to a value (depending of the value in the database).
    The user can change the value in the dropdown or unset the value.
    I put a reset button which set the selected index of the dropdown to -1 (the ‘please choose’ text appears).

    But when i sent the form to the server after resetting the dropdown, the value of the dropdown list is still the previous value.
    I try to write $(“#dropdown”).val(”) to set the value to null, but it does’nt work.

    The only way i found is, when the selected index is equal to -1, to clear the dropdown just before sending the form.

    Is it another way to set the selected value to nothing when the selected index is set to null (to -1) ?

    How to unset values of a dropdown #47959

    Peter Stoev
    Keymaster

    Hi antonomase,

    The “clearSelection” clears the selection.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    How to unset values of a dropdown #47998

    antonomase
    Participant

    Hi Peter,

    Thanks for your answer.

    You have 2 times the clear method in the api list.
    And (in my opinion), it will be easier to read if the methods will be sorted in alphabetic order.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.