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
45
How to prevent dropdown if nothing selected
posted

How can I prevent submit event when I haven't selected any selections on combobox. This happens when I click on the combobox arrow and select nothing!

I'm using DropDownClosed for submitting.

dropDownClosed: function (evt, ui) {
                    $(this).closest("form").submit();
                    
                }

Parents
  • 7595
    Verified Answer
    Offline posted

    Hello Mallor,

    Thank you for posting in our forum.

    In DropDownClosed event you could use ui.owner to obtain reference to igCombo .

    You could check if the value of the combo is greater than 0 then submit the page.

    Your code would be like this :

                   dropDownClosed: function (evt, ui) {

                   var dpValue = ui.owner.value();                                                           

                                  if(dpValue > 0)

                                  {

                                  alert("Submit form here");

                                  }

                                  else{

                                  alert("do not submit form");                                                        

                                  }

                                  } 

    I have created a sample application for your reference please find the attachment and let me know if you need further assistance.

    igCombo.zip
Reply Children
No Data